Re: supplied argument errors
| From: | David Robley | Date: | Wed, 24 Jun 2009 11:04:06 +0000 |
| Subject: | Re: supplied argument errors | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294519@lists.php.net to get a copy of this message | ||
PJ wrote:
> Lex Braun wrote:
>>
>>
>> On Tue, Jun 23, 2009 at 4:10 PM, PJ <af.gourmet@videotron.ca
>> <mailto:af.gourmet@videotron.ca>> wrote:
>>
>> I think there is something I do not understand in the manual about
>> mysql_fetch_assoc(), mysql_affected_rows()
>> The code works, but I get these annoying messages.
>> snippet:
>>
>> <snip>
>> What are the warnings?
> 1 .supplied argument is not a valid MySQL result resource
> 2. supplied argument is not a valid MySQL-link resource
>
> snippet:
> $result = mysql_query($sql, $db); // this is following an UPDATE
> $row = mysql_fetch_assoc($result); // warning... 1.
> if (mysql_affected_rows($result) !== -1) //warning...2.
> print_r($result); // returns 1
>
> another:
> $sql = "DELETE FROM book_categories WHERE bookID = $bid";
> $result = mysql_query($sql, $db); // warning...1.
> $row = mysql_fetch_assoc($result); // warning...1.
> if (mysql_num_rows($result) !== 0) {
> the last:
> $result = mysql_query($sql,$db); // following an INSERT
> if (mysql_affected_rows($result) == -1) { // warning....2.
>
>
>
Oh for $deity's sake, haven't you yet learned to a) echo your query and b)
use mysql_error() as aids to debugging errors with mysql ???
Cheers
--
David Robley
Imagery is All In The Mind.
Today is Setting Orange, the 29th day of Confusion in the YOLD 3175.