Echo autoincrement id doubt
Posted
by Marcelo
on Stack Overflow
See other posts from Stack Overflow
or by Marcelo
Published on 2010-06-10T05:13:12Z
Indexed on
2010/06/10
5:23 UTC
Read the original article
Hit count: 331
Hi, can I print the id, even if it's autoincrement ? Because the way I'm doing I'm using an empty variable for id.
$id= "";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die ("Não conectou com a base $database");
mysql_query("INSERT INTO table1(id,...)
VALUES ('".$id."',....)")
or die(mysql_error());
mysql_close();
echo "Your id is :";
echo "".$id;
I'm trying to print the id, but it's coming blank. I checked the table and there's an id number there. How can I print it then at?
Thanks for the attention
© Stack Overflow or respective owner