我有一個腳本,其中插入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? –