Fixed an omission in the script - user ID's were not being updated in the users table to point to the appropriate record in the accounts table

This commit is contained in:
jacob 2010-07-13 20:07:06 +00:00
parent 8a16a90c0e
commit 6eab783fb6

View File

@ -71,26 +71,33 @@ function db_update_195_post(){
if(!mysql_query($updateQuery)){
throw new Exception("Error on query \"$updateQuery\":\n\n" . mysql_error());
}
}
}else{
echo "Creating a new record for uid $uid ($username)\n";
$accounts_id = $uid;
$newAccountQuery = "INSERT INTO accounts VALUES ";
$newAccountQuery .= "($uid, '$username', '$password', '$email', '$pendingemail', '$superuser', $year)";
$newAccountQuery = "INSERT INTO accounts (`username`, `password`, `email`, `pendingemail`, `superuser`, `year`) ";
$newAccountQuery .= "VALUES ('$username', '$password', '$email', '$pendingemail', '$superuser', $year)";
if(mysql_query($newAccountQuery)){
// echo $newAccountQuery . "\n";
$accounts_id = mysql_insert_id();
}else{
throw new Exception("Error on query \"$newAccountQuery\":\n\n" . mysql_error());
}
}
/**************************************************
Now that we have an account created,
let's deal with the other tables.
**************************************************/
do{
// let's set the uid in this record to be the new ID in our accounts table
$query = "UPDATE users SET uid = $accounts_id WHERE id=" . $userRecord['id'];
if(!mysql_query($query)){
echo $query;
throw new Exception("Failed on updating users table for userid {$userRecord['id']}");
}
if($userRecord['year'] != 0){
$confQuery = mysql_query("SELECT * FROM conferences WHERE year = " . $userRecord['year']);
if($confQuery != false){