需要了解错误,我需要修复错误,以便显示数据库中的车辆。 WHat是布尔值,为什么它不起作用这是9个月前网站的备份。如果有人可以帮助我,请告诉我
</div>
<?php if(isset($_GET['dmsg']) && $_GET['dmsg']==1) { echo '<div align="center" style="color:green; font-weight:bold;">vehicles Deleted successfully..</div>';} ?>
<a href="insert-vehicles.php" style=" background: none repeat scroll 0 0 green; color: white; float: right; margin: 0 20px 0 0; padding: 10px;">Insert new Vehicles</a>
<div class="offer_area">
<div class="offer_head row">
<form action="" method="get" name="form1" class="key_form">
<label>Keyword :(search by Make, Model, Year, Stock no)</label>
<input name="keyword" type="text" value="<?php if($_GET['keyword']) {echo $_GET['keyword']; } ?>"/>
<input name="search" class="search" type="submit" value="search" />
</form>
</div>
<br />
<br />
<br>
<br>
<table width="90%" align="center" cellpadding="2" cellspacing="0">
<tr>
<th scope="col">IMAGE</th>
<th scope="col">STOCK NUMBER</th>
<th scope="col">MAKE</th>
<th scope="col">MODEL</th>
<th scope="col">YEAR</th>
<th scope="col">AUCTION DATE</th>
<th scope="col">SALE DOCUMENT</th>
<th scope="col">CURRENT BID PRICE</th>
<th scope="col">BUY NOW PRICE</th>
<th scope="col">ACTION</th>
</tr>
<?php
$id=1;
while ($GetUserQryRow = mysql_fetch_array($GetUserQryRs)) {
?>
<tr>
<td align="center"><img src="<?php echo $GetUserQryRow['defaultImg']; ?>" width="96"/> </td>
<td align="center"><?php echo $GetUserQryRow['StockNumber']; ?> </td>
<td align="center"><?php echo $GetUserQryRow['Make']; ?></td>
<td align="center"><?php echo $GetUserQryRow['Model']; ?> </td>
<td align="center"><?php echo $GetUserQryRow['Year']; ?></td>
<td align="center"><?php echo date('m, d Y H:i:s A',strtotime($GetUserQryRow['LiveAuctionDate'])); ?> </td>
<td align="center"><?php echo $GetUserQryRow['SaleDocument']; ?> </td>
<td align="center"><?php if(is_numeric($GetUserQryRow['CurrentBidPrice'])){ echo number_format($GetUserQryRow['CurrentBidPrice'],2); } ?> </td>
<td align="center"><?php if(is_numeric($GetUserQryRow['ibuyCost'])){echo number_format($GetUserQryRow['ibuyCost'],2); } ?> </td>
<td align="center"><a href="edit-vehicles.php?id=<?php echo $GetUserQryRow['StockNumber']; ?>">Update</a> <a href="javascript:void(0);" onclick="confirmdel('<?php echo $GetUserQryRow['StockNumber']; ?>');">Delete</a> </td>
</tr>
<?php $id++; } ?>
</table>
</div>
<?php include('sections/footer.php'); ?>
</div>
<p> </p>
</body>
</html>
答案 0 :(得分:1)
问题是当您使用mysql_query()发出sql查询时,代码中绝对没有错误处理。您应该通过检查每个mysql_query()的返回值来添加错误处理,如果使用mysql_error()遇到任何错误消息,则应该记录/显示错误消息。
$res=mysql_query(...);
if($res) {
//do your normal stuff
}
else {
echo mysql_error();
//decide to stop or render futher parts of the website
}
根据mysql错误消息,您可以解决您遇到的问题。但我的猜测是,与数据库的连接存在缺陷。密码错误,用户名或主机名错误。
编辑:请注意,mysql _ *()函数已经处于弃用状态,并且它们的支持将从php7中删除。转换为mysqli或PDO。