Setting Firebird Database Engine in PHP
<?php
session_start(); //You can enable error reporting by setting value to 1
error_reporting(0);
//echo session_id();
$_SESSION['currsession'] = session_id();
if(isset($_SESSION['result_session'])){
$endsession = $_SESSION['result_session'];
}
if($endsession == $_SESSION['currsession']){
header('location:grades.php');
}
include_once("DBConnect/constants.php");
include_once("DBConnect/DBInstance.php");
DBInstance::setDBEngine(DBASE_ENGINE);
DBInstance::setDBase(YOUR_DATABASE_NAME_HERE);
$dbInstance = DBInstance::getInstance();
$trans = ibase_trans(IBASE_DEFAULT,$dbInstance);
$positionList= array();
//if(isset($_POST["issubmit"])){
//validation here.
try{
$query = "Your Query Here";
$pstmt = ibase_prepare($trans,$query);
$result = ibase_execute($pstmt);
if(!$result){
throw new Exception(ibase_errmsg(),ibase_errcode());
}
while($row = ibase_fetch_object($result)){
$positionList[]= array(
"position"=>$row->POSITION,
"description"=>$row->DESC
);
}
//print_r($positionList);
ibase_commit($trans);
}catch(Exception $e){
echo "No data dump to system database, Transaction has been rolled back.";
echo $e->getMessage();
ibase_rollback($trans);
}
//}
?>
Note: If you are using Linux Web Server make sure that you have a correct Systax in PHP.