That would explain why it displays the second message saying it was not
successful.  But why then does it still display this warning?

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link
resource in c:\apache\htdocs\admin\stories.php on line 112

Mr. Austin
----- Original Message -----
From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Mr. Austin" <[EMAIL PROTECTED]>
Sent: Monday, February 02, 2004 10:41 PM
Subject: Re: [PHP] SQL Query Not Kosher?


> from the php function manual:
>
> <quote>
> Note: When using UPDATE, MySQL will not update columns where the new
> value is the same as the old value. This creates the possibility that
> mysql_affected_rows() may not actually equal the number of rows matched,
> only the number of rows that were literally affected by the query.
> </quote>
>
> http://nl2.php.net/mysql_affected_rows
>
> Mr. Austin wrote:
>
> > Hi all:
> >
> > I am trying to get this to work, but always get the same error: that the
resource in mysql_affected_rows() is not valid.  Anyone see why this would
be?  All variables have been tested for accuracy.
> >
> > $query = mysql_query("UPDATE stories SET status='approved' WHERE
story_id={$id}");
> >   if(mysql_affected_rows($query) == 1) {
> >     print("Your approval of \"$title\" was successful.  If this user
entered an email address, they have been sent a notice of its approval and
publication on the site.");
> >   } else {
> >     print("The approval of \"$title\" was not successful.  Please check
with the site administrator for assistance.");
> >   }
> >
> > The above SQL statement works perfectly with phpMyAdmin (and, oddly
enough, works with the above script, yet the Warning is produced and the
'not successful' message is displayed)  Any thoughts are appreciated!
> >
> > Mr. Austin
> >
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to