note 56339 rejected from function.dbase-delete-record by betz
| From: | betz@php.net | Date: | Tue, 06 Sep 2005 09:44:41 +0000 |
| Subject: | note 56339 rejected from function.dbase-delete-record by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94802@lists.php.net to get a copy of this message | ||
Note Submitter: eva20_1 at hotmail dot com
----
Hello,
I Have a PHP script with a database.
My php script is:
<?php
// Laat alle errors zien
error_reporting(E_ALL);
// Definities benodigt voor ADO-connectie
define('adCmdStoredProc', 4);
define('adOpenStatic', 3);
define('adUseClient', 3);
define('adLockOptimistic', 3);
define('adLockreadOnly', 1);
define('adOpenForwardOnly',0);
// Database initialiseren
$conn = new COM('ADODB.Connection');
$db = 'mdb.mdb';
$conn->CursorType = adOpenForwardOnly;
$conn->CursorLocation = 3;
$conn->LockType = 1;
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)};Persist Security info=false;
DBQ=$db");
// Include de FormHandler libs
include 'FH3/class.FormHandler.php';
// Functie welke wordt aangeroepen na het opslaan
function FH_handle($id, $data)
{
header('location:index.php');
}
// Toon lijst
$sql = "SELECT * FROM mdb ORDER BY naam";
$rs = $conn->Execute($sql);
?>
<table border="1">
<tr>
<th>Naam</th>
<th>Adres</th>
<th>Woonplaats</th>
<th> </th>
<th> </th>
</tr>
<?
while (!$rs->EOF)
{
?>
<tr>
<td><?= $rs->Fields['naam']->Value; ?></td>
<td><?= $rs->Fields['adres']->Value; ?></td>
<td><?= $rs->Fields['woonplaats']->Value; ?></td>
<td><a
href="?id=<?=$rs->Fields['id']->Value;?>">Bewerk</a></td>
<td><a
href="?id=<?=$rs->Fields['id']->Value;?>">Delete</a></td>
</tr>
<?
$rs->MoveNext();
}
?>
</table>
<?
// Start een nieuw formulier gebaseerd op FormHandler
$form = &new FormHandler();
// Gebruik de Access-database, tabel mdb
$form->dbInfo('mdb.mdb', 'mdb', 'access');
$form->dbConnect('', '', '');
// De formuliervelden
$form->TextField('Naam', 'naam', FH_STRING);
$form->TextField('Adres', 'adres', FH_STRING);
$form->TextField('Woonplaats', 'woonplaats', FH_STRING);
$form->SubmitButton('Opslaan');
// Wat gebeurt er na het opslaan?
$form->onSaved('FH_handle');
// Zet het formulier op het scherm
$form->Flush();
?>
----------------------------------------------
I can fill in data and than is it in de Database.
My Question is:
How can I Delete a record from my page, what are the codes exactly?
Also thnx,
Eva