Re: sorting and links

From: Date: Wed, 14 Feb 2001 15:48:57 +0000
Subject: Re: sorting and links
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6620@lists.php.net to get a copy of this message
On Wed, Feb 14, 2001 at 10:16:14AM -0500, Liz Bander wrote: > > 1. How do I sort a list through PHP alphabetically? This is a drop-down > menu full of part numbers and it's a pain in the neck to search for the > right one through about a thousand of them. Currently, the sort (or lack > thereof) is based on a primary key code (which other aspects of the > database are based on), and sorts it based on the number. This is not > user-friendly, and an alphabetical sort would make it much more so (this is > very important). Since you are using MySQL, just have MySQL do the sort. $sql = "select * from <table> order by <friendly_column>"; > > 2. There is a button that deletes a row from a table in my database. What > I need is for the button to delete the row and then return the user to the > previous page. Can it do both of these things? This again, is part of the > necessity for a user-friendly environment. You could split the page into parts. I often use an index.php page that only checks what is sent to it and then includes the appropriate page. For your example: if(isset($deleteButton)) { include("deleteRow.php"); include("previousPage.php"); } else { include("showForm.php"); } -- Jason Stechschulte jpstech@unoh.edu -- Either approach may give birth to various sorts of monstrosities. -- Larry Wall in <199710221950.MAA25210@wall.org>

« previous php.db (#6620) next »