Problem with MDB
| From: | Sonny | Date: | Sat, 06 Sep 2003 19:38:31 +0000 |
| Subject: | Problem with MDB | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-7614@lists.php.net to get a copy of this message | ||
Hello,
I working with PEAR::MDB which working mostly fine.
I don't know why but update,select works fine but delete won't work.
No errormessage comes back, so I don't know why it fails.
Code:
Form the Class:
class SQLmanager {
function SQLmanager() {
require_once 'MDB.php';
$this->db =& MDB::connect( $this->SQLdsn(), $this->_SQLoptions() );
if ( MDB::isError( $this->db ) ) {
MDB::raiseError( "Unable to connect to DB: $this->db->getMessage() " );
} else {
$this->db->setFetchMode( MDB_FETCHMODE_ASSOC );
$this->db->setErrorHandler( PEAR_ERROR_DIE );
}
}
function SQLooc() {
return $this->db;
}
Instance of the Class:
require 'lib/classes/SQL.php';
$sqlConn =& new SQLmanager();
$my = $sqlConn->SQLooc();
The delete code itself:
$sql1 = $my->prepareQuery("Delete from auth where
id='".$_REQUEST['id']."'");
$my->execute($sql1);
$sql2 = $my->prepareQuery("Delete from users where
uid='".$_REQUEST['id']."'");
$my->execute($sql2);
No error comes back and the data is still in the Database.
Someone an hint for me, why this is not working?
Cheers
-Peter