我有一个脚本,其中插入2通知到数据库表中,但它只是添加第一个音符,而不是第二个。我已经试过周围交换他们,它仍然只是张贴了第一个2。这里是我的代码:(!他们都==“”)PHP脚本不执行第二个命令
<?php
$type = "---";
$title = "---";
$note1 = "Note 1";
$note2 = "Note 2";
?>
<?php
if($business1 !== ""){
$insert_note1_sql = "INSERT INTO notes (id, recipient, type, title, post, message, date) VALUES('$id', 'Business 1', '$type', '$title', '$event', '$note1', '$time')";
$insert_note1_res = mysqli_query($con, $insert_note1_sql);
};
?>
<?php
if($business2 !== ""){
$insert_note2_sql = "INSERT INTO notes (id, recipient, type, title, post, message, date) VALUES('$id', 'Business 2', '$type', '$title', '$event', '$note2', '$time')";
$insert_note2_res = mysqli_query($con, $insert_note2_sql);
};
?>
任何人都可以看到,为什么第二个不行就不贴了?
您需要了解如何使用错误处理程序。 – Kermit
为什么你不断关闭和打开php标签?没有html,所以没有理由这样做。 –
什么是business2? –