I'm wondering.. is the PEAR system different?
I am using the PEAR and mdb2 system....
Code:
require_once 'MDB2.php';
$dsn = 'mysqli://a4500_lab14:******@localhost/a4500_DVDRentals';
$mdb2 =& MDB2::connect($dsn);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
//check to see if user wants to add
if (isset($_REQUEST["Add"]))
{
//insert the record
if ( isset( $_REQUEST["customer_id"] ) ) {
$sth = $mdb2->prepare( 'INSERT INTO customers (customer_id, fname, lname, city, phone, address, postal) VALUES (?, ?, ?, ?, ?, ?, ?)',
array('integer', 'text', 'text', 'text', 'integer', 'text', 'text' ),
MDB2_PREPARE_MANIP );
$sth->execute( array( $_REQUEST["customer_id"],
$_REQUEST["fname"],
$_REQUEST["lname"],
$_REQUEST["city"],
$_REQUEST["phone"],
$_REQUEST["address"],
$_REQUEST["postal"] ) );
}
}
//check to see if user wants to remove
if (isset($_REQUEST["Remove"]))
{
//delete the record
if ( isset( $_REQUEST["customer_id"] ) ) {
$sth = $mdb2->prepare( 'DELETE FROM customers WHERE customer_id = $_REQUEST["customer_id"]');
}
}
$res =& $mdb2->query('SELECT * FROM customers');
?>
my delete code won't work properly.
Bookmarks