$name = array('maxgebruikers' => $_POST['maxgebruikers']);
$name1 = array('maxplaylist' => $_POST['maxplaylist']);
array_push($name,$name1);
$result = mysql_query("SELECT * FROM organisation_settings WHERE organisation_id = '{$organisatieID}'");
if(mysql_fetch_assoc($result) == 0)
{
foreach($name as $type=>$value) {
mysql_query("INSERT INTO organisation_settings (type, value, organisation_id)
VALUES('{$type}', '{$value}' ,'{$organisatieID}')");
print_r($name);
}
}
else
{
foreach($name as $type=>$value) {
mysql_query("UPDATE organisation_settings
WHERE organisation_id = '{$organisatieID}'(type, value, organisation_id)
SET VALUES('{$type}', '{$value}' ,'{$organisatieID}')");
print_r($name);
}
}
正如你可以在图片中看到,我想去的地方类型是Mysql的INSERT INTO和更新将不会正常工作
就像我的阵列;
它不会插入正确,在哪里以及是什么在代码中的错误?
我知道我应该使用mysqli函数,但它现在不是重点。
值是否有信息?当您打印它们时,查询会输出什么内容? $结果输出是什么? – berentrom
你可以看到我的数组; http://imgur.com/HttqD4A。 $ result给出资源ID – STP38
我的意思是查看$ result和mysql_query的输出。 – berentrom