sw0o0sh Posted August 2, 2006 Share Posted August 2, 2006 Hi, I have a table in my SQL database called "chaoworld_a" without quotes.In it, I have a row called "Name" without quotes.I am trying to make a page where the PHP grabs all Name entries from chaoworld_a and descends it.Say a Name in table located on the database is Item 1, and Item 2,I am trying to make a page there would list it..So on a seperate page it'd say ..Item 1Item 2So on.I don't need a specific order, but using order by Name so it is in alphabetical order would be a plus. I need to know both methods..I suck really bad at PHP, and this code I made is very wrong.. a Fix on how I would do what I am trying to do would be nice.[code]<? $conn = mysql_connect("localhost","davessonicsite","password"); mysql_select_db(davessonicsite) or die(mysql_error()); $Name = mysql_query("SELECT Name * from chaoworld_a order by Name asc"); while ($Name = mysql_fetch_array($Name)){echo "$Name";} ?>[/code] Link to comment https://forums.phpfreaks.com/topic/16376-ascending-data-from-a-table-row-need-help/ Share on other sites More sharing options...
ItsWesYo Posted August 2, 2006 Share Posted August 2, 2006 Don't know if this will work xD[code]<?mysql_connect("localhost","user","password"); mysql_select_db("your_database"); $result = mysql_query("SELECT * FROM table_name ORDER BY Name");while($r=mysql_fetch_array($result)){ $name=$r["Name"]; // follow that format echo "$name<br>";}?>[/code]That should show all names in ABC order. Link to comment https://forums.phpfreaks.com/topic/16376-ascending-data-from-a-table-row-need-help/#findComment-68144 Share on other sites More sharing options...
sw0o0sh Posted August 2, 2006 Author Share Posted August 2, 2006 thanks it worked. Link to comment https://forums.phpfreaks.com/topic/16376-ascending-data-from-a-table-row-need-help/#findComment-68150 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.