Re: Newbie: Modify - Delete entries
| From: | KSchneider | Date: | Sat, 18 Aug 2001 00:35:11 +0000 |
| Subject: | Re: Newbie: Modify - Delete entries | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11491@lists.php.net to get a copy of this message | ||
Sébastien,
modify and delete submit buttons would probably be your best bet. my usual
modus operandi is to send an id number (or other qualifying criteria) to
the next page (often i use the very same page so as to not have to re-write
the form).
ex:
modify: send id in an input hidden statement with your form information
and use an update query --
<input type=hidden name=address_id value=$id>
then on the next page
$query = "update table set address_lname=$lname address_mname=$mname
address_phone=$phone where address_id = '$id'";
for a delete, use the same id field to locate the unique record in the
database:
$query = "delete from table where address_id = '$id'";
for sort order, use ORDER BY in your select statement:
$result = mysql_db_query($database,"select * from addressbook order by nom");
and
$result = mysql_db_query($database,"select * from addressbook order by nom
DESC");
will result in a descending sort order.
good luck,
Kate