Tandem Posted October 24, 2006 Share Posted October 24, 2006 Hi, i am drawing the names of cars out of my database. There are 6 different types of car and i want to put them in a specific order. I'm pretty sure i need to use a case statement to do this but i can't remember exactly how to do it as i need it, and when i google it i can't find anything that is similar to what i'm looking for.Can someone please demonstrate one for me?Thanks. Link to comment https://forums.phpfreaks.com/topic/24942-sql-case-statement/ Share on other sites More sharing options...
gmwebs Posted October 24, 2006 Share Posted October 24, 2006 [code]<?php$sql = "SELECT carname, make, model, color FROM cars ORDER BY carname ASC"; $result = mysql_query($sql, $conn);?>[/code] Link to comment https://forums.phpfreaks.com/topic/24942-sql-case-statement/#findComment-113666 Share on other sites More sharing options...
Tandem Posted October 24, 2006 Author Share Posted October 24, 2006 Thats not what i mean at all.I am drawing them by name only. The order is not alphabetical, it is a specific order set by me. Link to comment https://forums.phpfreaks.com/topic/24942-sql-case-statement/#findComment-113756 Share on other sites More sharing options...
trq Posted October 24, 2006 Share Posted October 24, 2006 [quote]The order is not alphabetical, it is a specific order set by me.[/quote]Then you should create an [i]orderby[/i] field in your database and order by that. Link to comment https://forums.phpfreaks.com/topic/24942-sql-case-statement/#findComment-113762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.