contra10 Posted January 24, 2009 Share Posted January 24, 2009 i'm trying to order by Date posted <?php $query = "SELECT * FROM events WHERE country='$postcountry' and continent='$postcontinent' and state_province = '$poststate'"; if(isset($_POST['submit']) and ($_POST['continent']) and ($_POST['country']) and ($_POST['state']) and ($_POST['eva']) and ($_POST['event']) and ($_POST['city'])){$query .= "and `evcity` = '$postcity' ORDER BY dateposted DESC";} ?> instead it orders by when it was inputted into sql Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/ Share on other sites More sharing options...
DeanWhitehouse Posted January 24, 2009 Share Posted January 24, 2009 Is that because it is posted when it is inserted into the db? Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745505 Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 that's a problem with your fields dude. Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745508 Share on other sites More sharing options...
contra10 Posted January 24, 2009 Author Share Posted January 24, 2009 i checked fields but i don't see the problem Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745515 Share on other sites More sharing options...
contra10 Posted January 24, 2009 Author Share Posted January 24, 2009 when it is inserteded into the database from another script the method is post Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745519 Share on other sites More sharing options...
void Posted January 24, 2009 Share Posted January 24, 2009 have you checked if it really adds addiotonal parameters to the query? Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745523 Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 And what is being inserted?? the time of insertion, correct? Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745526 Share on other sites More sharing options...
DeanWhitehouse Posted January 24, 2009 Share Posted January 24, 2009 Yes, that has nothing to do with anything In the insert code i take it you use a query similar to mysql_query("INSERT INTO table (row1,row2,dateposted) VALUES ('stuff','stuiff',NOW())"); That would set its time to the time it was run, therefore your order by is working Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745527 Share on other sites More sharing options...
contra10 Posted January 24, 2009 Author Share Posted January 24, 2009 yep i just figured that out right now...my stupid mistake Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745531 Share on other sites More sharing options...
contra10 Posted January 24, 2009 Author Share Posted January 24, 2009 i have to restructure my coding and the way it goes into sql Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745536 Share on other sites More sharing options...
rubing Posted January 24, 2009 Share Posted January 24, 2009 yes, do you want me to do it for you? what is your ftp username and password? Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745539 Share on other sites More sharing options...
DeanWhitehouse Posted January 24, 2009 Share Posted January 24, 2009 so you didn't read my first reply Is that because it is posted when it is inserted into the db? Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745540 Share on other sites More sharing options...
contra10 Posted January 24, 2009 Author Share Posted January 24, 2009 i did...but it didnt' click until after Quote Link to comment https://forums.phpfreaks.com/topic/142293-solved-order-by-not-working/#findComment-745548 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.