Php 图片和产品信息未显示在页面上
我一直在为我妻子的珠宝网站制作产品页面。我从教程中添加了php,并尝试运行该页面。包括页眉在内的所有图像都没有与页脚一起显示。它们每隔一页就会出现。信息产品也没有出现。页面显示连接已打开,我未收到任何错误。导航显示在一些css中,但仅此而已 这是我正在使用的代码Php 图片和产品信息未显示在页面上,php,html,css,mysqli,Php,Html,Css,Mysqli,我一直在为我妻子的珠宝网站制作产品页面。我从教程中添加了php,并尝试运行该页面。包括页眉在内的所有图像都没有与页脚一起显示。它们每隔一页就会出现。信息产品也没有出现。页面显示连接已打开,我未收到任何错误。导航显示在一些css中,但仅此而已 这是我正在使用的代码 <?php error_reporting(E_ALL); ini_set('display_startup_errors', 1); ini_set('displa
<?php
error_reporting(E_ALL);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
?>
<?php
if (isset($_GET['id'])) {
// Connect to the MySQL database
include_once("storescripts/connect_to_mysql.php");
$con =
mysqli_connect("$db_host","$db_username","$db_pass","$db_name");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_errno());
exit();
} $id = preg_replace('#[^0-9]#i', '', $_GET['id']);
$sql = "SELECT * FROM products WHERE category='Bracelets';";
$result = mysqli_query($con, $sql);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck > 0) {
// get all the product details
while($row = mysqli_fetch_assoc($result)); {
$item_number = $row["item_number"];
$price = $row["price"];
$desc = $row["description"];
$category = $row["category"];
}
} else {
echo "Data to render this page is missing.";
exit();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Bracelets</title>
<meta charset="utf-8">
<meta http-equiv="x=UA-comparable" content="IE-edge">
<meta name="description" content="Pinky's Pearls is a website where
one
of a kind jewelry designed by Nichole <q>Nicki</q> can be seen and
purchased">
<meta name="keywords" content="jewelry, beads, bracelets, rings,
pendants, necklaces, pearls, crystal">
<meta name="viewpoint" content="width=device-width, initial-scale=1">
<meta name="author" content="samuel jaycox">
<link href="style.css" rel="stylesheet">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="shortcut icon" type="image/png" href="pictures/pinky.png">
<script src="https://use.fontawesome.com/0c9491c5b9.js"></script>
</head>
<body>
<div align="center" id="wrapper">
<div id="banner-wrapper">
<?php
include_once("c:/xampp/htdocs/pinkys_pearls/templates/template_bracelets.php");
?>
<br>
<?php include_once("templates/template_navigation.php"); ?>
<br>
<br>
<br>
<!--Start Comment page Body Content-->
<div id="body-content">
<div class="bracelet_body">
<table width="100%" border="2" cellspacing="0" cellpadding="15">
<tr>
<td width="19%" valign="top"><img src="pictures/inventory/<?php echo
$pid; ?>.png" width="142" height="188" alt="<?php echo $item_number; ?>"
/>
<br />
<a href="pictures/inventory/<?php echo $pid; ?>.png">View Full Size
Image</a></td>
<td width="81%" valign="top"><h3><?php echo $item_number; ?></h3>
<p><?php echo "$".$price; ?><br />
<br />
<?php echo $desc; ?>
<br />
</p>
<form id="form1" name="form1" method="post" action="cart.php">
<input type="hidden" name="pid" id="pid" value="<?php echo $id; ?
>"
/>
<input class="button" type="submit" name="button" id="button"
value="Add to Shopping Cart" />
</form>
</td>
</tr>
</table>
</div>
</div>
<!--end of Comment body-->
<?php include_once('templates/template_footer.php'); ?>">
</body>
</html>
请确保您的路径正确强>
尝试更改您的链接
作为
并且确保您的图像路径,如果文件夹不同,您无法加载图像。您在html部分的哪里定义了$pid
?请在包含一次
中查看您的url。它在同一个目录中吗?如果是,请不要使用url,如c:/xampp/htdocs
,您的页脚在哪里?我看不到您在HTMLI中包含的任何页脚。昨晚我在处理页脚部分时,无意中取出了页脚部分。我重新编辑了php,显示了页脚和导航,但页眉仍然没有显示。它显示在dreamweaver的查看器中。仍然无法获取产品信息。将项目放入数据库时,在“库存列表”页面上定义了$pid。它是图片id的变量。我已经仔细检查了路径并重新输入了php。我仍然没有从数据库中获得信息。换言之,我需要的所有信息从行类别与手镯的价值。我的新php位于顶部,嗨,请使用crome浏览器中的inspect元素,然后转到console选项卡菜单查看错误显示。这将帮助您这是控制台所说的:[弃用]资源请求,其URL包含删除的空格(\n\r\t)字符和少于个字符(