// Add user info into the database table for the main site table
$sql = "INSERT INTO users (username, email, password, gender, city, state, sign, month, day, year, ip, signup, lastlogin, notescheck)
VALUES('$u','$e','$p_hash','$g','$c','$S','$s','$m','$d','$y','$ip',now(),now(),now())";
$query = mysqli_query($db_conx, $sql);
$uid = mysqli_insert_id($db_conx);
// Establish their row in the useroptions table
$sql = "INSERT INTO useroptions (id, username, background) VALUES ('$uid','$u','original')";
$query = mysqli_query($db_conx, $sql);
// Establish their row in the match_profile table
$sql = "INSERT INTO match_profile (profileId, username) VALUES ('$uid','$u')";
$query = mysqli_query($db_conx, $sql);
// Establish their row in the sign table
$sql = "INSERT INTO sign (sign_id, username, sign_name, birthmonth, birthday, birthyear) VALUES ('$uid','$u','$s','$m','$d','$y')";
$query = mysqli_query($db_conx, $sql);
//$uid = mysqli_insert_id($db_conx);
// Update KEYS in User Table
$sql = "UPDATE users SET useroptions_id='$uid', match_id='$uid', sign_id='$uid' WHERE id='".$uid."'";
$query = mysqli_query($db_conx, $sql);I wan't this database to be normalized, so in the user table I added three
foreign keys.What I don't know is how to add the value in the database table after the INSERT.
I tried this, but it did not work.
//$uid = mysqli_insert_id($db_conx);
// Update KEYS in User Table
$sql = "UPDATE users SET useroptions_id='$uid', match_id='$uid', sign_id='$uid' WHERE id='".$uid."'";
$query = mysqli_query($db_conx, $sql);
What would be the correct way to tackle this problem?