I want to insert data from an array. Below is an example situation.
I grab all my friends available in friends list (fb) and store them in an array.
Now I want to insert their data ( name, fbid, birthday ) into a table.
Currently I'm doing this using a for loop below is an example code.
<?php
  $friendsname = $_POST['name'];
  $friendsfbid = $_POST['fbid'];
  $friendsbday = $_POST['birthday'];
  for($i<0;count($friendsfbid);$i++){
     $sql_query  = "INSERT INTO table (fbid, name, birthday) VALUES ('$friendsfbid[$i]','$friendsname[$i]','$friendsbday[$i]') ON DUPLICATE KEY UPDATE fbid='$friendsfbid[$i]', name='$friendsname[$i]', birthday='$friendsbday[$i]'";    
  }
?>
Now if I have 300 friends this will loop 300 times.
The more number of friends the more time its going to take to process the data.
Is there a way to avoid this or to increase the performance of the code. ?
Using PHP with mySQL
 
     
     
     
    