Re: Last auto generate id
if you are inserting something and want the ID of the item you just inserted, you can use mysql_insert_id(), like so:
PHP Code:
mysql_query("INSERT INTO table (field1, field2) VALUES (value1, value2)");
$id = mysql_insert_id();
but, if you just want to get the very last ID in general (and haven't inserted anything), you can just do a regular query and sort it by the ID (descending), and limit it to 1 result.
Code:
SELECT id FROM table WHERE field=value ORDER BY id DESC LIMIT 1
hope that answers your question. the end of your post got me a little confused with what you're trying to do.