Re: Problem with an update after an insert: MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It would make things easier if you could determine the error, so try to use mysql_error after all your mysql_queries, not just after the first one.

Stefan


Bestman4unowwa@xxxxxxx wrote:
I'm having trouble with having trouble with doing an update after doing an insert on and a select on a table. The order of execution is:
$result = mysql_query("select token from tokenuserid where userid = '$none' ");
if (!$result)
echo mysql_error();
$numresult = mysql_num_rows($result);
$row = mysql_fetch_row($result);
$gotToken = $row[0];


$generatedToken = date(YmdHis);
$result = mysql_query("insert into tokenuserid values ('$generatedToken', '$none')");
$result = mysql_query("update tokenUserid set userid = '$userid' where token = '$gotToken'");
if (!$result)
echo "can't find user"; I can't get this update to take. Actually, I can get this to work on one implementation of this database and on the next implementation of this it doesn't work. returning the error after the update. The MySQL version is 3.23.52. Is it because I have a capital U in the name tokenUserid in the update statement? I could believe this as a reason since the table is defined as: tokenuserid - (without any caps). If this is the problem then why does it occur in one implementation and not the other?



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux