Jump to content

Display data by alphabetical order


RON_ron

Recommended Posts

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);

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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