TylerRLD Posted April 20, 2013 Share Posted April 20, 2013 I currently have a php set up for a high-scores list. The mysql database has 3 fields. 1-id 2-Name 3-Score id is set to auto increment ive got it working to properly input name and score into the database and it automatically gives the entry an "id"... heres the code: $dbc = mysql_connect('ZShiscoreapp.db.10895904.hostedresource.com','username','password'); if (!$dbc) { die('Not Connected :' .mysql_error()); } $db_selected = mysql_select_db("ZShiscoreapp", $dbc); if (!$db_selected) { die("Cant Connect : " .mysql_error); } $pname=$_GET['nameinput']; $pscore=$_GET['scoreinput']; $query="INSERT INTO highs SET Score='$pscore', Name='$pname' "; $result=mysql_query($query); I want to get the assigned "id" from the database and print it. how can i do this? Quote Link to comment Share on other sites More sharing options...
trq Posted April 20, 2013 Share Posted April 20, 2013 mysql_insert_id. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.