Re: supplied argument errors
| From: | PJ | Date: | Tue, 23 Jun 2009 21:00:30 +0000 |
| Subject: | Re: supplied argument errors | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294486@lists.php.net to get a copy of this message | ||
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.
--
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- pj@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php