0

Need to understand error, I need to fix the error so the vehicles are shown that are in the database. WHat is boolean and why isnt it working this is a backup of the website 9 months ago . If anyone can help me please let me know

               </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>
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

1

The problem is that there is absolutely no error handling in your code when you issue sql queries using mysql_query(). You should add error handling by checking the returned value from every mysql_query() and log / display error messages if any encountered using 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
}

Based on the mysql error message you can resolve the issues you have. My guess is, however, that the connection to the database is flawed. Wrong password, or username, or hostname.

EDIT: pls note that mysql_*() functions are slready in deprecated status and their support will be removed from php7. Convert to mysqli or PDO.

Shadow
  • 33,525
  • 10
  • 51
  • 64