How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues
2 posts • Page 1 of 1
- Posts: 2272
- Joined: Sat Jul 05, 2003 1:18 pm
- Location: A bunk in the back
toweter wrote:try it like that:
mysql_query("UPDATE table1 set item1='bar' WHERE id = ".LAST_INSERT_ID());
Um, toweter.. LAST_INSERT_ID() is a MySQL function, not a PHP function, so it has to be part of the query. PHP will just throw a "undefined function" error.
Anyway, atroz, I'm guessing that the problem here is that, to quote the docs, "The last ID that was generated is maintained in the server on a per-connection basis." I'm guessing that between the time you create the record and when you try to UPDATE it, you've since created a new connection (e.g. you're running a different script or a different instance of the script).
You could just use MAX(id) instead, I suppose.
Who is online
Users browsing this forum: No registered users and 1 guest