One way to do it would be thusly:

$result=mysql_query(yadayada);
foreach($result as $row){
echo '
<tr><td>
<a href="delete.php?id=' . $row[id] . '">' . $row[name] . '</a>
...
</tr>';
}

This would set up a url that when the user clicks on $row[name] (such as
"Record Description" it would call delete.php with the argument of $row[id]

Within that delete.php, you remove the selected record, then call the
original page.

Use:
$sql="DELETE from table where id=$id";

Then do:
echo '
Header("Location: original_location.php");

You can't have any html previous to the Header command, though.

This will return you to your original page where you can do your select
again, and the deleted row won't show up.

You may need to pass parameters on the Header line to let
original_location.php exactly where you were previously. This would have to
be passed either on the url or as a post/get operation when first calling
delete.php




Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:[EMAIL PROTECTED]
http://accessingram.com


-----Original Message-----
From: Peter Goggin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 8:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP amd MYSQL


I am setting up a web page system which involves html pages, php pages and
mysqldatabase.

I have a number of questions and do not know where to find answers.

If  I display the rows from a database table in a php generated html table
is it possible to mark a row so that it can be deleted or modified by
calling another php page? If so is this documented anywhere?

Is there any good source of information on setting up 'forms'to work like
Oracle forms where database records can be inserted, updated or deleted?


Regards


Peter Goggin




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to