RE: [PHP-DB] Problem with an update after an insert: MySQL
| From: | Bastien Koert | Date: | Mon, 07 Feb 2005 17:18:08 +0000 |
| Subject: | RE: [PHP-DB] Problem with an update after an insert: MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38498@lists.php.net to get a copy of this message | ||
Change yourr code to place the sql into a variable and the echo the variable out to see what the problem might be. You can also cut'n'paste the variable into the the mysql gui of your choice to see if there are other errors
Bastien
From: Bestman4unowwa@aol.com To: php-db@lists.php.net Subject: [PHP-DB] Problem with an update after an insert: MySQL Date: Mon, 7 Feb 2005 11:31:52 EST 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?