title: Using SELECT resultset to run UPDATE query with MySQL Stored Procedures
body: <p>I'm trying to understand MySQL Stored Procedures, I want to check if a users login credentials are valid and if so, update the users online status:</p>
  
  <pre><code>-- DROP PROCEDURE IF EXISTS checkUser;
  DELIMITER //
  CREATE PROCEDURE checkUser(IN in_email VARCHAR(80), IN in_password VARCHAR(50))
  BEGIN
      SELECT id, name FROM users WHERE email = in_email AND password = in_password LIMIT 1;
      -- If result is 1, UPDATE users SET online = 1 WHERE id = "result_id";
  END //
  DELIMITER ;
  </code></pre>
  
  <p>How Can I make this if-statement based on the resultsets number of rows == 1 or id IS NOT NULL?</p>