title: INSERTING values from one table into another table
body: <p>I have this code to select all the fields from the 'jobseeker' table and with it it's supposed to update the 'user' table by setting the userType to 'admin' where the userID = $userID (this userID is of a user in my database). The statement is then supposed to INSERT these values form the 'jobseeker' table into the 'admin' table and then delete that user from the 'jobseeker table. The sql tables are fine and my statements are changing the userType to admin and taking the user from the 'jobseeker' table...however, when I go into the database (via phpmyadmin) the admin has been added by none of the details have. Please can anyone shed any light onto this to why the $userData is not passing the user's details from 'jobseeker' table and inserting them into 'admin' table?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  
  include ('../database_conn.php');
  
  $userID = $_GET['userID'];
  
  $query = "SELECT * FROM jobseeker WHERE userID = '$userID'";
  $result = mysql_query($query);
  $userData = mysql_fetch_array ($result, MYSQL_ASSOC);
  $forename = $userData ['forename'];
  $surname = $userData ['surname'];
  $salt = $userData ['salt'];
  $password = $userData ['password'];
  $profilePicture = $userData ['profilePicture'];
  
  $sQuery = "UPDATE user SET userType = 'admin' WHERE userID = '$userID'";
  
  $rQuery = "INSERT INTO admin (userID, forename, surname, salt, password, profilePicture) VALUES ('$userID', '$forename', '$surname', '$salt', '$password', '$profilePicture')";
  
  $pQuery = "DELETE FROM jobseeker WHERE userID = '$userID'";
  
  
  mysql_query($sQuery) or die (mysql_error());
  $queryresult = mysql_query($sQuery) or die(mysql_error());
  
  
  mysql_query($rQuery) or die (mysql_error());
  $queryresult = mysql_query($rQuery) or die(mysql_error());
  
  mysql_query($pQuery) or die (mysql_error());
  $queryresult = mysql_query($pQuery) or die(mysql_error());
  
  
  mysql_close($conn);
  
  
  header ('location:     http://www.numyspace.co.uk/~unn_v002018/webCaseProject/index.php');
  
  ?&gt;
  </code></pre>