Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   view the reort in ascending order (http://www.go4expert.com/forums/view-reort-ascending-t23985/)

newphpcoder 25Nov2010 06:28

view the reort in ascending order
 
Good day!
I have a mysql_query code to sleect the date from the database and my problem is the output is not in ascending order. Here is my code:
PHP Code:

 $query "SELECT plt_no FROM plt_transact WHERE plt_date BETWEEN '" $_POST["from_date"] . "' AND '" $_POST["to_date"] . "' "

I try this code
PHP Code:

 $query "SELECT plt_no FROM plt_transact WHERE plt_date BETWEEN '" $_POST["from_date"] . "' AND '" $_POST["to_date"] . "' ORDER BY plt_no ASC "

But it did not work...where i can put the code for Asc.
Thank you

Max2010 26Nov2010 15:55

Re: view the reort in ascending order
 
you ordered by plt_no, you should order by plt_date instead:

PHP Code:

$query "SELECT plt_no FROM plt_transact WHERE plt_date BETWEEN '" $_POST["from_date"] . "' AND '" $_POST["to_date"] . "' ORDER BY plt_date ASC;"

I also suggest you to sanitize the POST inputs before querying a db

newphpcoder 30Nov2010 05:28

Re: view the reort in ascending order
 
Quote:

Originally Posted by Max2010 (Post 75230)
you ordered by plt_no, you should order by plt_date instead:

PHP Code:

$query "SELECT plt_no FROM plt_transact WHERE plt_date BETWEEN '" $_POST["from_date"] . "' AND '" $_POST["to_date"] . "' ORDER BY plt_date ASC;"

I also suggest you to sanitize the POST inputs before querying a db

Thank you


All times are GMT +5.5. The time now is 08:09.