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
[EMAIL PROTECTED]
--
Either approach may give birth to various sorts of monstrosities.
-- Larry Wall in <[EMAIL PROTECTED]>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]