foreach进入mysql表[关闭]

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

Watch in to direction of ORM. It simplifies most common security issues and easy to use. Alternative is to simply use PDO, which is mostly part of PHP library and is on many servers installed by default.