Re: Multiple MySQL Queries
| From: | Jim Lucas | Date: | Tue, 28 Jul 2009 18:22:36 +0000 |
| Subject: | Re: Multiple MySQL Queries | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295964@lists.php.net to get a copy of this message | ||
sono-io@fannullone.us wrote:
> Hi Jim,
>
>> Take a look inside your money_format() function look for the problem.
>
> I apologize for replying too quickly.
>
> The money_format() function looks just like the one I had before, so
> that's fine.
>
> Upon closer inspection, I found a few problems:
>
> 1] WHERE categories='{$cat}"'
> should be
> WHERE categories='{$cat}'
Sorry, my bad
>
> 2] if ( ( $results = mysql_query($SQL, $db) !== false ) {
> should be
> if ( $results = mysql_query($SQL, $db) !== false ) {
>
But, you do want the first line, expect with the closing bracket.
if ( ( $results = mysql_query($SQL, $db) ) !== false ) {
You want to have the inner portion processed then the comparison done.
Not the other way around.
> With those fixed, the page is rendering now, but giving me this error:
> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL
> result resource
>
> for this line:
> while ( $item = mysql_fetch_assoc($result) ) {
>
Should be
while ( $item = mysql_fetch_assoc($results) ) {
> and the tables are blank. Only the table headers show. So...
> everything except the while statement appears to be working.
>
> I've Googled that error message but can't find the casue. Any help
> would be much appreciated.
>
> Frank
Sorry about the other typo's!
Jim