2015-10-13 59 views
0

中给出的布尔值需要了解错误,我需要修复错误,以便车辆显示在数据库中。什么是布尔值,为什么它不工作这是9个月前网站的备份。如果有人能帮助我,请让我知道MySQL问题 - 警告:mysql_num_rows()期望参数1是资源,在

   </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>&nbsp;&nbsp;<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>&nbsp;</p> 
</body> 

</html> 
+0

我想你没有完全发布代码。我似乎无法找到SQL语句分配。 – Reinard

+0

嘿最新你的电子邮件? –

+0

到处都有相同的问题,请检查:http://rossadamcohen.com/asa/admin/vehicles.php –

回答

1

的问题是,有绝对的()没有错误在你的代码处理,当您使用的mysql_query发出SQL查询。如果使用mysql_error()遇到任何错误,则应该通过检查每个mysql_query()和log/display错误消息的返回值来添加错误处理。

$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 _ *()函数slready在弃用状态,他们的支持将从php7中删除。转换为mysqli或PDO。

+0

不知道你怎么帮忙? –

+0

对不起,但我不明白你的意见。 – Shadow

相关问题