我正在創建一個電子商務網站並製作訂購系統,但是我的代碼如下所示,出現「數據丟失此頁面丟失」錯誤。我嘗試了各種各樣的工作,但不要縫隙進一步解決這個問題。在php頁面上顯示產品時遇到問題
你能否看看我是否錯過了任何東西或者如果有解決方案這個問題?
在這個階段,我試圖從SQL數據庫
展示我的產品感謝您的幫助
<?php
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php
// Check to see the URL variable is set and that it exists in the database
if (isset($_GET['clothing_name'])) {
// Connect to the MySQL database
include "/xampp/htdocs/website/connection.php";
$sql = mysql_query("SELECT * FROM items WHERE clothing_name='$clothing_name' LIMIT 1");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
// get all the clothing details
while($row = mysql_fetch_array($sql)){
$clothing_name = $row["clothing_name"];
$size = $row["size"];
$price = $row["price"];
$details = $row["details"];
}
} else {
echo "That item does not exist.";
exit();
}
} else {
echo "Data to render this page is missing.";
exit();
}
mysql_close();
?>
顯然你的if語句失敗了。這是一個簡單的if語句。 '$ _GET ['clothing_name']'沒有設置。找出爲什麼。 –
'/youtpage.php?clothing_name = 1'你忘了申請'clothing_name' – Jack
@JohnConde,謝謝你的回覆。我會研究它並回復你。 – Priya