title: How do I execute the same stored procedure in multi-times in MySQL or PHP?
body: <p>In my <a href="https://stackoverflow.com/questions/5447511/how-to-check-if-tow-columns-are-duplicate-when-insert-data-in-mysql">previous question</a>.I have got the solution to check out which data was duplicated before insert data. This is the MySQL stored procedure to check data:</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS check_user_files;
  DELIMITER \\  
   CREATE PROCEDURE check_user_files(IN p_user_id INT,IN p_file_id CHAR(10))
     BEGIN
          IF EXISTS(SELECT 1 FROM myTable WHERE user_id = p_user_id AND file_id= p_file_id) THEN
              UPDATE myTable SET `file_status`=0 WHERE user_id=p_user_id AND file_id=p_file_id;
          ELSE
              INSERT INTO myTable(`user_id`,`file_status`,`file_id`) 
              VALUES (p_user_id,0,p_file_id);
          END IF; 
      END \\
  DELIMITER ;
  </code></pre>
  
  <p>To call the stored procedure:</p>
  
  <pre><code>CALL check_user_files('1','12');
  </code></pre>
  
  <p>The <code>table [myTable]</code> structure:</p>
  
  <pre><code>auto_id  user_id  file_id file_status
  1        1        12        1
  2        3        12        0
  3        1        17        1
  4        4        31        1
  5        1        41        0
  6        4        31        0
  7        1        18        1
  8        5        11        0
  9        1        10        0
  </code></pre>
  
  <p>And my problem is, I have multi-data to check and insert at the same time.E.g:</p>
  
  <pre><code>('1','12'),('2','14'),('3','16'),...
  </code></pre>
  
  <p>But I can't call the stored procedure at the same time to check all records at one time.E.g:</p>
  
  <pre><code>CALL check_user_files('2','12');
  CALL check_user_files('3','12');
  ...
  </code></pre>
  
  <p>It only call the first line of stored procedure.</p>
  
  <p>So, how can I check all records in one query at the same time!></p>
  
  <p>Thank you very much!!</p>