Date: 10/15/01
- Next message: Tomas Garcia Ferrari: "Re: [PHP-DB] mysql ID's"
- Previous message: Henrik Hansen: "[PHP-DB] Re: Sub routines in php"
- In reply to: George Lioumis: "[PHP-DB] UPDATE table problem"
- Next in thread: Jason Wong: "Re: [PHP-DB] UPDATE table problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
$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,
Would the mysql_affected_rows function better suit your requirements?
- returns the number of rows affected by the last INSERT, UPDATE or DELETE query
http://www.php.net/manual/en/function.mysql-affected-rows.php
If it returns -1 there is a logic failure in the query.
If it returns >=0 then that many rows were updated - provided data did actually change.
NB read the manual page carefully for that 'gotcha'.
Hope this helps! I have just posted a tutorial level coverage of post-processing the mysql_query
function to the [PHP] list (PHP-General) (Re: [PHP] MySQL resource). If you're interested but do not
subscribe, I'll email-forward you a personal copy upon request.
Regards,
=dn
-- 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>
- Next message: Tomas Garcia Ferrari: "Re: [PHP-DB] mysql ID's"
- Previous message: Henrik Hansen: "[PHP-DB] Re: Sub routines in php"
- In reply to: George Lioumis: "[PHP-DB] UPDATE table problem"
- Next in thread: Jason Wong: "Re: [PHP-DB] UPDATE table problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

