當我執行下面的代碼時,附加圖像中以黃色突出顯示的查詢將打印在頁面中。我不想打印該SQL。我的代碼段有什麼問題? INSERT期間正在執行sql查詢
if(isset($_REQUEST["stu_performance_activity_submit"]))
{
$stu_performance_main_category = $_REQUEST["stu_performance_main_category"];
$stu_performance_sub_category = $_REQUEST["stu_performance_sub_category"];
$stu_performance_activity_name = $_REQUEST["stu_performance_activity_name"];
$stu_performance_activity_date = $_REQUEST["stu_performance_activity_date"];
$stu_performance_activity_description = $_REQUEST["stu_performance_activity_description"];
$newc = "INSERT INTO stu_performance_activity
(stu_performance_activity_id,
stu_performance_main_category,
stu_performance_sub_category,
stu_performance_activity_name,
stu_performance_activity_date,
stu_performance_activity_description)
VALUES ('',
'$stu_performance_main_category',
'$stu_performance_sub_category',
'$stu_performance_activity_name',
'$stu_performance_activity_date',
'$stu_performance_activity_description')";
if($connection->query($newc) === TRUE)
{
}
else
{
echo "Error: " . $newc . "<br>" . $connection->error;
}
}
打印就像一個有用的wrror消息'$連接 - > error' – RiggsFolly
你開始的PHP代碼以'<?php'標籤 – RiggsFolly
這解決了這個問題。我錯過了添加<?php相反,有.謝謝@RiggsFolly! –