eugene2009 Posted November 22, 2009 Share Posted November 22, 2009 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 More sharing options...
KingIsulgard Posted November 22, 2009 Share Posted November 22, 2009 Can you please explain what the specific problem is? Link to comment https://forums.phpfreaks.com/topic/182483-just-some-advise/#findComment-963225 Share on other sites More sharing options...
eugene2009 Posted November 22, 2009 Author Share Posted November 22, 2009 It displays the same category over and over.. when i only need it to show once.. It gets it from every row.. I need to know how to set up the mysql table the right way.. Link to comment https://forums.phpfreaks.com/topic/182483-just-some-advise/#findComment-963503 Share on other sites More sharing options...
cags Posted November 22, 2009 Share Posted November 22, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.