mus Posted August 3, 2011 Share Posted August 3, 2011 hi some people can help me im new in php. i want to sorting nummer in my table nam ( row) $result = mysql_query("SELECT * FROM opi ordre by row desc") have i done this right code Quote Link to comment Share on other sites More sharing options...
requinix Posted August 3, 2011 Share Posted August 3, 2011 Almost. Take a closer look at what you typed. And use tags when you post PHP code. Quote Link to comment Share on other sites More sharing options...
IrOnMaSk Posted August 3, 2011 Share Posted August 3, 2011 just typo mistake <?php $result = mysql_query("SELECT * FROM opi order by row desc");//error message can go here after ; Quote Link to comment Share on other sites More sharing options...
mus Posted August 4, 2011 Author Share Posted August 4, 2011 hi IrOnMaSk <?php$result = mysql_query("SELECT * FROM opi order by row desc");//error message can go here after ; i now this code will be error but i dont now how i can make this can some people help me Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 4, 2011 Share Posted August 4, 2011 You need tp put space between <? php and $result <? $result = mysql_query("SELECT * FROM opi order by row desc"); Quote Link to comment Share on other sites More sharing options...
mus Posted August 4, 2011 Author Share Posted August 4, 2011 yes but code is not work please help me thanks but thanks for help voip03 Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 4, 2011 Share Posted August 4, 2011 you have a row called row? that sounds weird and it's probably a mysql reserved name. try this, but replace TABLE with your table name, and ROW with your row name (leave the backticks) $result = mysql_query("select * from `TABLE` order by `ROW` desc"); Quote Link to comment Share on other sites More sharing options...
mus Posted August 4, 2011 Author Share Posted August 4, 2011 thanks you this code work good but if i want to have small nummer first.examples 1, ,2, 3,4 not 4, 3, 2, 1, thanks Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 4, 2011 Share Posted August 4, 2011 remove the word 'desc' from the query. Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 4, 2011 Share Posted August 4, 2011 Sort by ASC or DESC http://php.about.com/od/learnmysql/p/SQL_order_by.htm Quote Link to comment Share on other sites More sharing options...
mus Posted August 4, 2011 Author Share Posted August 4, 2011 thanks u very much WebStyles and voip03 Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 5, 2011 Share Posted August 5, 2011 please mark as solved. the topic solved button can be found at the bottom left of the page. thank you 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.