<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // Diaplay php errors
require_once('classes/interfaceDB.php');// include DB interface
######## This object is used for operation related to Mysqli
$host = 'localhost';
$user = 'root';
$password = '';
$db = 'db';
require_once('classes/clsDBMysqli.php');
$objDB=new DBMysqli();
if(!$objDB->connectDB($host,$user,$password,$db)){ // Connecting to databse
echo $objDB->_errorstr ;die; // display connection error
}
global $objDB; // object to be used to insert and fetch records
######## This object is used for operation related to Mysql
require_once('classes/clsDBMysql.php');
$objDB=new DBMysql();
if(!$objDB->connectDB($host,$user,$password,$db)){ // Connecting to databse
echo $objDB->_errorstr ;die; //display connection error
}
global $objDB; // object to be used to insert and fetch records
//Insert into table
$falg=$objDB->insert(array('pankaj','pankaj@email.com'),'user');
if(!$flag){
echo $objDB->_errorstr;
}
$result=$objDB->fetchAll("select * from user where id=?",array('name','pankaj'));
print_r($result);
?>
|