forked from science-ation/science-ation
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:
parent
8a16a90c0e
commit
6eab783fb6
@ -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){
|
||||
|
Loading…
Reference in New Issue
Block a user