RE: [PHP-DB] UPDATE table problem From: Rick Emery (remery <email protected>)
Date: 10/15/01

The reason you're getting "Resource = id#2" is because you've used $result
from a previous statement like:
$result = mysql_query()

$result is simply an identifier. To determine WHAT it identifies, you must
extract the rows to which it
refers, i.e.:

$result = mysql_query($some_query) or die(mysql_error());
while( $row = mysql_fetch_array($result) )
{
  $update_query = "update guestbook set last_access=3Dnow() where =
guest_id='$result'";
  mysql_query($update_query) or die(mysql_error());
  // do other stuff
}

-----Original Message-----
From: George Lioumis [mailto:glioumis <email protected>]
Sent: Monday, October 15, 2001 8:31 AM
To: php-db <email protected>
Subject: [PHP-DB] UPDATE table problem

Hi, everyone, again,

Consider the following piece of code:
-------------------------
$update_query =3D "update guestbook set last_access=3Dnow() where =
guest_id=3D'$result'";
 $update_query =3D stripslashes($update_query);
 echo $update_query;
 echo "<BR><BR>";
 $updated =3D mysql_query($update_query) or die(mysql_error());
if ($updated)
  {
.............etc etc
  }
--------------------------
When ran, it returns:
update guestbook set last_access=3Dnow() where guest_id=3D'Resource =
id#2'

The problem is that if($updated) returns TRUE, but the last_access field =
is not updated at all !!! :(((
Any ideas as far as the $update_query is concerned???

George

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>