Hi everyone.
sorry to disturb everyone again.
i have been stuck on this problem for 2 days now .
i have created a database and i am able to populate the database. however the mysql_insert_id does not seem to collect the ID . i am at a complete loss where i am going wrong.
any help will be appreciated.
i enclose below the SQL for the database and the PHP script for my insertion.
USE global;
CREATE TABLE users(
user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
email VARCHAR (60) NOT NULL,
pass CHAR(40) NOT NULL,
reg_date DATETIME NOT NULL,
first_name VARCHAR(20) NOT NULL,
surname VARCHAR(20) NOT NULL,
nationality TINYTEXT NOT NULL ,
PRIMARY KEY (user_id));
// Make the query:
//$q = "INSERT INTO users (first_name, last_name, email, pass, reg_date) VALUES ('$fn', '$ln', '$e', SHA1('$p'), NOW() )";
$q = "INSERT INTO users
( email, pass, first_name, last_name , country_loc, reg_date) VALUES ('$EA', SHA1('$PW'), '$FN', '$LN', '$CL', NOW() )";
$r = mysqli_query ($dbc, $q); // Run the query.
$id = mysql_insert_id( );
if ($r) { // If it ran OK.
// Print a message:
echo "$id";
echo '<h1>Thank you!</h1>
<p>You are now registered. In Chapter 11 you will actually be able to log in!</p><p><br /></p>';
} else { // If it did not run OK.
// Public message:
echo '<h1>System Error</h1>
<p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p>';
// Debugging message:
echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $q . '</p>';
} // End of if ($r) IF.