Jump to content

[SOLVED] help with ORDER BY


rsammy

Recommended Posts

this is my query...

 

 

$query2="SELECT batch_ID, batch_date_created, batch_time_created
			 FROM billing_batch
			 WHERE batch_date_created <= '$dates' AND batch_date_created >= '$datez'
			 ORDER BY  batch_ID, '$select'";

 

$select above is either ascending or descending on the screen based on option chosen from drop down box.

 

i know the query is not corect at the ORDER BY point. how do i make it sort it accroding to option selected for '$select' ??? right now, it just displays ascending whatever i choose becos the syntax is wrong.

 

HELP PLEASE....

 

Link to comment
Share on other sites

Again, back to my questions:

Well, what are the exact values in the select field? if they are not ASC or DESC you will need to convert the values to those first. Also, are you sending the value through GET or POST?

 

Are you populating the value of $select from the POST or GET object? Have you verified that the value is what you expected to be?

 

if it put a ',' there, it does not show me in the order selected(shows ascending by default). but if remove the ','  it shows an error on screen!

What error are you getting. We don't have crystal balls.

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.