im a real newbie when it comes to sql but im trying to pick up the pieces of my friends site... It all seems to be working fine apart from the left hand navigation to certain categories. This is the site: http://tyresinwigan.co.uk/new/
The individual manufacturers should point to each manufacturer direct but they seem to be listing the results for all manufacturers.
Here is the code from the search.php:
<?php
require_once('const.php');
$link = dbConnect();
$manufacturer_id = 0;
$name = '';
if (isset($_GET['make']) && is_numeric($_GET['make'])) {
$manufacturer_id = (int) $_GET['make'];
}
$query = "SELECT manufacturer_name FROM manufacturer_tbl WHERE manufacturer_id = $manufacturer_id";
$result = false;
$result = @mysql_query($query, $link);
if (($result) && (@mysql_num_rows($result) > 0)) {
$row = @mysql_fetch_array($result, MYSQL_ASSOC);
$name = stripslashes($row['manufacturer_name']);
}
$query = "SELECT *,
v.vehicle_id AS vehicle_id_alias
FROM vehicle_tbl AS v
LEFT JOIN image_tbl AS i ON v.vehicle_id = i.vehicle_id
GROUP BY v.vehicle_id
HAVING v.manufacturer_id = $manufacturer_id";
$offers = false;
$offers = @mysql_query($query, $link);
$items = 0;
if ($offers) $items = mysql_num_rows($offers);
function nextOffer() {
global $offers;
global $items;
$items --;
if ($offers && ($row = mysql_fetch_array($offers))) {
if (! isset($row['image_name'])) { // no image
$image = 'images/noimagesml.jpg';
} else {
$image = 'images/vehicles/sml/'.stripslashes($row['image_name']);
}
$title = stripslashes($row['manufacturer_name']).' '.stripslashes($row ['vehicle_model']);
$price = number_format((float) $row['vehicle_price_pcm'], 2);
$id = (int) $row['vehicle_id_alias'];
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="contenthead"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11" height="40" align="left" valign="top"><img src="images/featre_left_hd.gif" width="11" height="23"></td>
<td width="100%" align="left" valign="middle" class="contenthead">'.$title.'</td>
<td width="11" height="40" align="right" valign="top"><img src="images/featre_rght_hd.gif" width="11" height="23"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="contentpane"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td align="center" valign="middle"><img src="'.$image.'" width="100" height="58" class="bordered" alt="'.$title.'"></td>
</tr>
<tr>
<td align="center" valign="top" class="princing">from just £'.$price.' pcm</td>
</tr>
<tr>
<td align="right" valign="middle"><a href="cardeal.php?vehicle='.$id.'"><img src="images/more_butt.gif" width="54" height="20" border="0"></a></td>
</tr>
</table></td>
</tr>
</table>';
} else {
echo ' ';
}
}
?>