Hi,
I basically can't seem to extract the auto_increment user_id field and use it in the next query. Would being on a mac have anything to do with this problem? I'm using MAMP with the standard settings. I hope it's not a configuration issue.
Why? I have tried to echo the value of user_id but nothing happens. No zero, no null, nothing.
However, the user_id is indeed being created; I just can't use it.
$TableName = "roster";
$SQLString = "INSERT INTO $TableName (first, last, email, password)
VALUES ('$first', '$last', '$email', SHA('$password'))";
$QueryResult = @mysqli_query($DBConnect, $SQLString) or die ("<p>Error querying table: $TableName </p>" . "<p>Error code " . mysqli_errno($DBConnect)
. ": " . mysqli_error($DBConnect) . "</p>");
$user_id = mysql_insert_id(); //this is the problemic area I believe
echo "user id is: " . $user_id; //nothing shows to the browser.
My table is set up correctly:
user_id is primary key, auto_increments
first
last
email
password