Lex Braun wrote:
>
>
> On Tue, Jun 23, 2009 at 4:10 PM, PJ <[email protected]
> <mailto:[email protected]>> 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 --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php