Retrieving Autogenerated content in mysql using php
Well, here's my problem. I've got a php script which posts a message to a mysql database. The mysql database generates two values automatically, one is a timestamp and the other one is a unique id for the message.
I need those values to be able to update my page using ajax (j开发者_StackOverflow社区son). I want to know how do I get those values from the same php script from where i've posted my message to be stored in the mysql database?
mysql_insert_id
will give you the last autoincrement value. Then you can use a SELECT
to retrieve the timestamp.
You could use mysql_insert_id
to retrieve last inserted ID from the table
精彩评论