我在PHP产品的第36行继续收到此错误,第36行是:(它是一个电子商务网站)
<?php
include '../inc/theprodukts.php';
?>
当我向下移动几行时,它会移动错误行,因此错误显然在我的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);
?>
答案 0 :(得分:0)
echo "<a href='../sider/productdetail.php?productid=" . $row['ID'] . "&?cat=" . $row['cat'] . "'><img src='../bilder/detaljer.gif' alt=''width='53' height='19'></a>";
注意&amp;在网址建设中。
将其更改为:
echo "<a href='../sider/productdetail.php?productid=" . $row['ID'] . "&?cat=" . $row['cat'] . "'><img src='../bilder/detaljer.gif' alt=''width='53' height='19'></a>";
并且在while循环中也是如此。