944,144 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 6362
  • PHP RSS
Sep 13th, 2004
0

sort on field names; refresh page?

Expand Post »
I only started last week with php mysql(be nice)

I have a MySQL db where a user can enter contact info, usually stuff:
FirstName
LastName
Address
City
State
Zip

I return this info to a php page which shows all info in db.

$result = mysql_query("SELECT * FROM contacts");

I would like to make some sort fields for the page. Sort by LastName or Sort by State.

I know how to write the sql for the query for the db, what I am unsure of is how to use it on the php page and get the page re-displayed when the label is clicked?

hope thats clear. thank you for your time.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vree is offline Offline
2 posts
since Sep 2004
Sep 14th, 2004
0

Re: sort on field names; refresh page?

Sort by LastName
[PHP]$result = mysql_query("SELECT * FROM contacts ORDERBY LastName");[/PHP]

Sort by State
[PHP]$result = mysql_query("SELECT * FROM contacts ORDERBY State");[/PHP]
PoA
Reputation Points: 19
Solved Threads: 9
Posting Whiz in Training
PoA is offline Offline
234 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP .tpl format template help! URGENT!
Next Thread in PHP Forum Timeline: error installing Apache





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC