我一直试图建立一个网站。这是一个在线购物网站。
这是我的代码-
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Books And Beyond</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap styles open source -->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" crossorigin="anonymus">
<!-- Customize styles -->
<link href="style.css" rel="stylesheet"/>
<!-- font awesome styles open source -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymus">
<!-- Favicons -->
<link rel="shortcut icon" href="/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style
type="text/css">
<!--
body {
background-image: url(assets/img/background.jpg);
}
-->
</style></head>
<body>
<!--
Upper Header Section
-->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="topNav">
<div class="container">
<div class="alignR">
<?php if (isset($_SESSION['email'])) { echo $_SESSION['email']; } else { ?>
<ul class="nav pull-right">
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"><span class="icon-lock"></span> Login <b class="caret"></b></a>
<div class="dropdown-menu">
<form class="form-horizontal loginFrm" action="checkuser.php" method="post">
<div class="control-group">
<input name="email" type="text" class="span2" id="email" placeholder="Email">
</div>
<div class="control-group">
<input name="password" type="password" class="span2" id="password" placeholder="Password">
</div>
<div class="control-group">
<label class="checkbox">
<input type="checkbox"> Remember me
</label>
<button name="login" type="submit" class="shopBtn btn-block">Sign in</button>
</div>
</form>
</div>
</li>
</ul>
<?php } ?>
<?php if (isset($_SESSION['email'])) { ?>
<a href="logout.php"> Logout </a>
<?php } else { ?>
<a href="register.php"><span class="icon-edit"></span> Register </a>
<?php }?>
</div>
</div>
</div>
</div>
<!--
Lower Header Section
-->
<div class="container">
<div id="gototop"> </div>
<header id="header">
<div class="row">
<div class="span4">
<h1>
<a class="logo" href="index.php"><span>Books And Beyond</span>
<img src="assets/img/logo1.jpg" alt="" width="218" height="94"> </a> </h1>
</div>
</div>
</header>
<!--
Navigation Bar Section
-->
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="index.php">Home</a></li>
<li class=""><a href="about.php">About</a></li>
<li class=""><a href="bargain.php">Bargain Books</a></li>
<li class=""><a href="new.php">New Releases</a></li>
<li class=""><a href="best.php">Bestsellers</a></li>
<li class=""><a href="contact.php">Contact Us</a></li>
</ul>
<ul class="nav pull-right">
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span12">
<img src="assets/img/banner.jpg"/>
<hr class="soften"/>
</div>
</div>
<!--Body Section
-->
<div class="row">
<div id="sidebar" class="span3">
<div class="well well-small">
<h3> Category </h3>
<ul class="nav nav-list">
<li><a href="fiction.php"><span class="icon-chevron-right"></span>Fiction</a></li>
<li><a href="nonfiction.php"><span class="icon-chevron-right"></span>Non-Fiction</a></li>
<li><a href="young.php"><span class="icon-chevron-right"></span>Young Adult</a></li>
<li><a href="children.php"><span class="icon-chevron-right"></span>Children's</a></li>
<li><a href="travel.php"><span class="icon-chevron-right"></span>Travel</a></li>
<li><a href="education.php"><span class="icon-chevron-right"></span>Education</a></li>
<li style="border:0"> </li>
</ul>
</div>
<!--<div class="well well-small alert alert-warning cntr">
<h2>50% Discount</h2>
<p>
only valid for online order. <br><br><a class="defaultBtn" href="#">Click here </a>
</p>
</div>-->
<!-- <div class="well well-small" ><a href="#"><img src="assets/img/paypal.jpg" alt="payment method paypal"></a></div>-->
<!--<a class="shopBtn btn-block" href="#">Upcoming products <br><small>Click to view</small></a>-->
<ul class="nav nav-list promowrapper">
<?php
/* require_once('dbconnect.php'); */
$result = mysql_query("SELECT * from product WHERE brand='accessories'");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li>
<div class="thumbnail">
<img width="200" height="80" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption">
<table width="250" border="0">
<tr>
<td align="left" valign="middle"><form action="product_detail.php" method="post" name="form2" id="form2">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
</label>
</form></td>
<td align="right" valign="middle"><h4> <span class="pull-right"><?php echo $price; ?>.00</span></h4></td>
</tr>
</table>
</div>
</div>
</li>
<li style="border:0"> </li>
<?php } ?>
</ul>
</div>
<div class="span9">
<!--
New Products
-->
<div class="well well-small">
<h3>New Products </h3>
<hr class="soften"/>
<div class="row-fluid">
<div id="newProductcar" class="carousel slide">
<div class="">
<div class="item active">
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='bousni' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<a href="#" class="tag"></a>
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='hela couture' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<a href="#" class="tag"></a>
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='zey' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<a href="#" class="tag"></a>
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='AL-JUMAIRA' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<a href="#" class="tag"></a>
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="well well-small">
<div class="span8">
<div class="row-fluid">
<h3>Features Products </h3>
<hr class="soften"/>
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='roza' LIMIT 3");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$productname=$row["productname"];
$brand=$row["brand"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li class="span4">
<div class="thumbnail">
<img width="250" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption cntr">
<p style="color:#990033"><?php echo $productname; ?></p>
<p><?php echo $brand; ?></p>
<p><strong>SAR <?php echo $price; ?>.00</strong></p>
<div class="btn-group">
<form id="form2" name="form2" method="post" action="product_detail.php">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
<input name="Submit2" type="submit" class="defaultBtn" value="Add to cart" />
</label>
</form>
</div>
<br class="clr">
</div>
</div>
</li>
<?php } ?>
</ul>
<hr class="soften"/>
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='haya' LIMIT 3");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$productname=$row["productname"];
$brand=$row["brand"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li class="span4">
<div class="thumbnail">
<img width="250" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption cntr">
<p style="color:#990033"><?php echo $productname; ?></p>
<p><?php echo $brand; ?></p>
<p><strong>SAR <?php echo $price; ?>.00</strong></p>
<div class="btn-group">
<form id="form2" name="form2" method="post" action="product_detail.php">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
<input name="Submit2" type="submit" class="defaultBtn" value="Add to cart" />
</label>
</form>
</div>
<br class="clr">
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
<div class="row">
</div>
</div>
</div></div></div>
<!--
Footer
-->
<footer class="footer" style="float: bottom;">
<div class="row-fluid">
<div class="span3">
<h5>ORDER SUPPORT</h5>
<a href="contact.php">Store pickup</a><br>
<a href="return.php">Return and Refund</a><br>
</div>
<div class="span3">
<h5>PRODUCT SUPPORT</h5>
<a href="faqs.php">FAQs</a><br>
<a href="inquiry.php">Inquiry</a><br>
</div>
<div class="span3">
<h5>COOPORATIVE INFO</h5>
<a href="terms.php">Terms and Condition</a> <br>
<a href="contact.php">Contact us</a><br>
</div>
<div class="span3">
<h5>GET CONNECTED</h5>
<a href="about.php">About us</a> <br>
<a href="register.php">Create Account</a><br>
</div>
</div>
</footer>
</div><!-- /container -->
<div class="copyright">
<div class="container">
<p class="pull-right"> </p>
<span>Copyright 2019, Fatimatuz Johura - s201403034- Jeddah (Ladies Branch);<br> Books And Beyond</span>
</div>
</div>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.easing-1.3.min.js"></script>
<script src="assets/js/jquery.scrollTo-1.4.3.1-min.js"></script>
<script src="assets/js/shop.js"></script>
</body>
</html>
“新产品”和页脚部分不来了,我不知道为什么。我还没有网络主机,所以我现在正在使用本地主机。我曾尝试编辑代码,但是无论如何,它似乎都无法正常工作。如果有人可以提供帮助,我将不胜感激。谢谢。
答案 0 :(得分:0)
在线152(新产品在线〜185 [ish])
/* require_once('dbconnect.php'); */
$result = mysql_query("SELECT * from product WHERE brand='accessories'");
正如我在评论中所说,您多次使用此require_once('dbconnect.php');
,而在文件顶部仅应使用一次。
上面的代码是我第一次发现,正如它被注释掉的那样,该查询将轰炸您。执行从上到下进行,第一个未提交的发生是第196行,这对第一个查询来说是很晚的方式。
就像我在评论中所说的
尝试打开错误报告-
error_reporting(-1);
和ini_set('display_errors', '1');
将它们放在<?php
标签之后
您可以节省自己,这样我们可以节省很多时间。
所以在夏日,
删除所有这些require_once('dbconnect.php');
,然后在打开的<?php
标签之后添加一个。
PS,只需注释掉第一个查询,或者取消注释第一个require_once
,就可以轻松地进行测试。