RON_ron Posted September 14, 2010 Share Posted September 14, 2010 I want to pull the mysql data in an alphabetical order suburbz. This code is not getting the results in an alphabetical order. Please help. $SomeVar = $_POST['disloc']; $query = "SELECT * FROM books WHERE statez = '".$SomeVar."' ORDER BY suburbz ASC"; $results = mysql_query($query); Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/ Share on other sites More sharing options...
Rifts Posted September 14, 2010 Share Posted September 14, 2010 try $SomeVar = $_POST['disloc']; $query = "SELECT * FROM books WHERE statez = $SomeVar ORDER BY suburbz ASC"; $results = mysql_query($query); Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1110854 Share on other sites More sharing options...
RON_ron Posted September 14, 2010 Author Share Posted September 14, 2010 No luck as yet!! Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1110856 Share on other sites More sharing options...
Rifts Posted September 14, 2010 Share Posted September 14, 2010 post the error you get. Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1110857 Share on other sites More sharing options...
RON_ron Posted September 14, 2010 Author Share Posted September 14, 2010 NO data was shown. Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1110859 Share on other sites More sharing options...
the182guy Posted September 14, 2010 Share Posted September 14, 2010 I want to pull the mysql data in an alphabetical order suburbz. This code is not getting the results in an alphabetical order. Please help. $SomeVar = $_POST['disloc']; $query = "SELECT * FROM books WHERE statez = '".$SomeVar."' ORDER BY suburbz ASC"; $results = mysql_query($query); Use mysql_error() to get a description of the problem. It's most likely either the table or a field name is wrong or the data that is being posted contains bad chars and is causing the query to break due to not escaping the string before putting it in the query. Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1110863 Share on other sites More sharing options...
chintansshah Posted September 14, 2010 Share Posted September 14, 2010 Can you tell me what you get in $_POST['disloc']? No data found then problem with your input. Please try query without WHERE, if you get correct output what you expect then you have problem with inputs. $query = "SELECT * FROM books ORDER BY suburbz ASC"; $results = mysql_query($query); Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1110866 Share on other sites More sharing options...
RON_ron Posted September 14, 2010 Author Share Posted September 14, 2010 the182guy: Typical asian answers! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1110923 Share on other sites More sharing options...
fenway Posted September 15, 2010 Share Posted September 15, 2010 the182guy: Typical asian answers! Thanks! So, solved? Quote Link to comment https://forums.phpfreaks.com/topic/213356-display-data-by-alphabetical-order/#findComment-1111372 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.