I want to upload the results of an array into a DB table.
foreach ($f_list as $list) {
echo '<a href="http://facebook.com/'.$list['id'] . '"><br>';
echo $list['name'] . '</a><br>';
}
I want the name and UID to upload into my db. How can i accomplish this with a foreach method?
$sql=array();
foreach ($f_list as $list) {
//This assumes, your values are already safely quoted
$sql[]="'".$list['id']."','".$list['name']."'";
}
$sql=implode('),(',$sql);
$sql="INSERT INTO tablename VALUES($sql)";
// now run the query