0
這是我的插件工作的代碼需要插入2個數組到phpmyadmin,但錯誤的forach循環的PHP ...任何解決方案....任何替代解決方案如何插入?爲foreach()提供的無效參數任何解決方案
if (isset($_POST['addvenue'])) {
<?php echo "<pre>".print_r($_POST['RoomTilte'],true)."</pre>";
echo "<pre>".print_r($_POST['Capacity'],true)."</pre>";
mysql_connect("localhost","root","");//database connection
mysql_select_db("ossd");
$a=array($_POST['RoomTitle']);
if (is_array($a))
{
echo"yes it is array";
foreach ($_POST['RoomTitle'] as $row=>$name)
{
$Roomtitle = $name;
$Capacity = $_POST['Capacity'][$row];
$RoomTitle= mysql_real_escape_string($name);
$Capacity = mysql_real_escape_string($_POST['Capacity'][$row]);
$order = "INSERT INTO wp_ossd_venue
(RoomTitle,Capacity)
VALUES
(".$RoomTitle.",".$Capacity.")";
$result = mysql_query($order);
}
}
if($result){
echo("<br>Succesfully Added");
} else{
echo("<br>Fail... Error");
}
}