我在我的 PHP 产品的第 36 行不断收到此错误,第 36 行是这样的:(它是一个电子商务网站)
<?php
include '../inc/theprodukts.php';
?>
当我将 include 向下移动几行时,它会移动错误行,因此错误显然在我的 theprodukts.php 中,如下所示。
<?php
$CatID = $_GET['cat'];
$dbhost = "127.0.0.1";
$dbuser = "root";
$dbpass = "";
$db = "nettbutikk";
$con = mysqli_connect($dbhost,$dbuser,$dbpass,$db);
if (mysqli_connect_errno($con))
{
echo "Error: " . mysqli_connect_error();
}
if ($CatID == "all")
{
$checkproducts = mysqli_query($con,"SELECT * FROM products");
while($row = mysqli_fetch_array($checkproducts))
{
echo "<div class='produktboks'>";
echo "<p class='produktnavn'>" . $row['name'] . "</p>";
echo "<div class='photos'><img alt='' width='130px' height='90px' src='../bilder/produktbilder/" . $row['img'] . "' />";
echo "<p>pris : " . $row['price'] . " Kr</p>";
echo "<a href='../sider/productdetail.php?productid=" . $row['ID'] . "&?cat=" . $row['cat'] . "'><img src='../bilder/detaljer.gif' alt=''width='53' height='19'></a>";
echo "<a href='../inc/addtocart.php?productid=" . $row['ID'] . "'><img src='../bilder/cart.gif' alt='' width='71' height='19'></a>";
echo "<br>";
echo "<br>";
echo "</div>";
echo "</div>";
}
}else{
$checkproducts = mysqli_query($con,"SELECT * FROM products
WHERE cat=" . $CatID);
while($row = mysqli_fetch_array($checkproducts))
{
echo "<div class='produktboks'>";
echo "<p class='produktnavn'>" . $row['name'] . "</p>";
echo "<div class='photos'><img width='130px' height='90px' src='../bilder/produktbilder/" . $row['img'] . "' />";
echo "<p>pris : " . $row['price'] . " Kr</p>";
echo "<a href='../sider/productdetail.php?productid=" . $row['ID'] . "&?cat=" . $row['cat'] . "'><img src='../bilder/detaljer.gif' alt=''width='53' height='19'></a>";
echo "<a href='../inc/addtocart.php?productid=" . $row['ID'] . "'><img src='../bilder/cart.gif' alt='' width='71' height='19'></a>";
echo "<br>";
echo "<br>";
echo "</div>";
echo "</div>";
}
}
mysqli_close($con);
?>