title: How to execute SELECT and INSERT in single query with PHP/MYSQL?
body: <p>I have a table <code>user_name</code> with 3 fields, <code>id, Name, Email</code> (<code>id</code> is <code>auto_increment</code> field). I want to execute the following query in PHP, but its not returning any result.</p>
  
  <pre><code>INSERT INTO user_name (Name, Email) VALUES ('Example', 'example@xyz.com'); 
  SELECT LAST_INSERT_ID() AS 'userid';
  </code></pre>
  
  <p>When I am executing the above query in PHP as below then its not returning anything.</p>
  
  <pre><code>$_SQL="INSERT INTO user_name (Name,Email) VALUES ('Example', 'example@xyz.com'); 
  SELECT LAST_INSERT_ID() AS 'userid';";
  
  $result_last_id = @mysql_query($_SQL);
  $rs_insert = mysql_fetch_array($result_last_id);
  
  $new_userid = $rs_insert['userid'];
  </code></pre>
  
  <p>Can anyone please tell me how to execute both queries into one.</p>