Hi all
I am working on a project and I can not seem to get this right no mater what I do.
I have 3 tables in db, year, manufacturer_id and models
I would like to display makes and models based on requests made by user. I.e., if a user selects Make as Ford and then Year as 1942 the Model should return a list of all models produced in that year. However it does not work can some one tell me where I am going wrong please.
[php]
<?php
$sql=“SELECT id,model FROM model WHERE year_id=‘1’”;
$result =mysql_query($sql);
while ($data=mysql_fetch_assoc($result)){
?>
<?php echo $data['model'] ?>
<?php } ?>[/php]
My data bases tables are set up as follows.
manufacturer
2 columns id (which is unique) and manufacturer
year
2 columns id (which is unique) and year
model
4 columns id (which is unique) year (which corresponds to year id table) manufacturer_id (which corresponds to manufactures id table) and model