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 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 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 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 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 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 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 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 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 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.