Jump to content

Just some advise..


eugene2009

Recommended Posts

Hello, I have this site that displays different galleries of cars.. On there, I have an admin page where it allows the administrators to upload different pictures of different cars.  So heres my problem.. just to start browsing the viewer would have to go to something called..

 

categories.php

 

Here I would like all the different types of makes displayed that are hyperlinked to the next page on where to select a model...

So say my admin wants to add a new photo to  a category that doesnt exist.. he selects lamborghini for example and uploads the pic into that category.. that way in categories.php it would automatically show up a new category because of the mysql fetch function.

 

Something like this:

 

$query = "SELECT * FROM cars ORDER BY makeid"; 
$result = mysql_query($query); 

while($row = mysql_fetch_assoc($result)){

echo "<a href=\"view_categories.php?id=' . $row['makeid'] . "\">' . $row['makeid'] . '</a>";

 

So pretty much where it will fetch all the categories and link them all on one page.. I have it all figured out but the way my mysql database is setup it displays the same link x number of pictures there are because i do not understand how to set it up correctly.. i googled it over 100 times and I cant find what im looking for.. somebody please help me..

 

 

Link to comment
https://forums.phpfreaks.com/topic/182483-just-some-advise/
Share on other sites

Since you are using makeid surely you have an independent table that contains information relative to the make such as make id along with make name? If not it sounds like you want something like...

 

SELECT DISTINCT makeid FROM cars ORDER BY makeid

Link to comment
https://forums.phpfreaks.com/topic/182483-just-some-advise/#findComment-963515
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.