The website I am editing lives on a Win 2003 server, php5, iis6. The database connection is a .csv file I have set up as System DSN. I works fine except for the following:
I am trying to get the database results to display only the vehicles priced 10,000 and under. Here is my code:
<?php
require('dconn.php');
$sql = "SELECT * from carcompany.csv where sellingprice <= '9999' order by sellingprice desc";
$result = odbc_exec($db, $sql);
while (odbc_fetch_row($result)) {
?>
<div id="results2">
<form action="moreinfo.php" method="post">
<table style="width: 550px; margin:auto;" cellpadding="0">
<tr>
<td style="width: 20%" rowspan="4">
<img alt="Photo" src="<?php echo odbc_result($result, "photourl1"); ?>" width="100" height="75" /></td>
<td style="width: 20%; height: 25px;">Make</td>
<td style="width: 20%; height: 25px;"><?php echo odbc_result($result, "make"); ?></td>
<td style="width: 20%; height: 25px;">Model:</td>
<td style="width: 20%; height: 25px;"><?php echo odbc_result($result, "model"); ?></td>
</tr>
<tr>
<td style="width: 20%; height: 25px;">Year:</td>
<td style="width: 20%; height: 25px;"><?php echo odbc_result($result, "year"); ?></td>
<td style="width: 20%; height: 25px;">Transmission:</td>
<td style="width: 20%; height: 25px;"><?php echo odbc_result($result, "transmission"); ?></td>
</tr>
<tr>
<td style="width: 20%; height: 25px;">Miles</td>
<td style="width: 20%; height: 25px;"><?php echo odbc_result($result, "miles"); ?></td>
<td style="width: 20%; height: 25px;">Price:</td>
<td style="width: 20%; color:#cdeb8b; height: 25px;"><strong>$<?php echo odbc_result($result, "sellingprice"); ?>.00</strong></td>
</tr>
<tr>
<td style="width: 20%; height: 25px;">
<input name="Submit1" type="submit" value="More Info" /></td>
<td style="width: 20%; height: 25px;"> </td>
<td style="width: 20%; height: 25px;"> </td>
<td style="width: 20%; height: 25px;"> </td>
</tr>
<tr>
<td colspan="5" style="height: 25px"><hr/></td>
</tr>
</table>
<input type="hidden" name="moreinfo" value="<?php echo odbc_result($result, "vin"); ?>"/>
</form>
</div>
<?php
}
?>
</div>
</div>
<div id="footer">
<div id="copyright">
<p class="copyright">Copyright <span class="style1"> </span>2007 Car Company. All rights reserved.</p>
</div>
</div>
<?php
exit;
?>
dconn.php contains the database connection properties.
What happens when the code is executed is it displays all the vehicles 9999 and under first in descending order, but then proceeds to display all the other vehicles in descending order starting at 39,000 going down to 10,000. I only want vehicles under 10000 displaying.
The second thing that happens is if I change <= '9999'
to <='10000' it displays no results. Technically, I want it to be 10,000 and under for my results, but 9999 is the only way I've been able to get any results at all. Fast help would be appreciated. Thanks for the help in advance.