Jump to: navigation, search

PHP ADODB Delete Record

From w3cyberlearnings

Contents

PHP ADODB Delete Record

Delete multiple or single record.

Syntax ADODB

$sql = "DELETE FROM user_infor WHERE email=?";
$conn1->Execute($sql, array('[email protected]');

Example 1

<?php

include 'adodb5/adodb.inc.php';

$host = 'localhost';
$user = 'user2000';
$pass = 'password2000';
$dbname = 'w3cyberlearning';

$conn1 = &ADONewConnection('mysql');
$conn1->PConnect($host, $user, $pass, $dbname);

$sql = "DELETE FROM user_infor WHERE email=?";

$my_data = array(
	 array('[email protected]'),
	 array('[email protected]')
);

for ($i = 0; $i < count($my_data); $i++) {
	$d = $conn1->Execute($sql, $my_data[$i]);
	if (!$d) {
		print 'error' . $conn1->ErrorMsg() . '<br>';
	} else {
		echo 'Success! Delete';
		echo "<br/>";
	}
}
?>


Related Links


Navigation
Web
SQL
MISC
References