Location: PHPKode > scripts > metafire > metafire/test_metafire.php
	$fbird = new metafire;
	// test simple query
	// use this if only select operation
	$sql = "select first_name,last_name  from employee";
	while ($fbird->fetchObject($intQuery)) {
		echo $rows.". ".$fbird->fetchRow("first_name")." ".$fbird->fetchRow("last_name")."<br>";
	echo "Query script: ".$fbird->strQuery."<br><br><br>";
	$coln = $fbird->GetNumFields($intQuery); 
	for ($i=0 ; $i < $coln ; $i++) { 
          $col_info = $fbird->GetFieldInfo($intQuery,$i);
  	  	 echo "name: ".$col_info['name']."\n"; 
   		 echo "alias: ".$col_info['alias']."\n"; 
    		 echo "relation: ".$col_info['relation']."\n"; 
   		 echo "length: ".$col_info['length']."\n"; 
   		 echo "type: ".$col_info['type']."<br>"; 
	// test query with transaction
	// prefereble for insert,update,delete operation as u can rollback when u need to
	$sql = "update employee set last_name='Nelson' where emp_no=2";
	//not auto commit
	//u can only rollback what u have no committed
	// test prepared query 'update' with transaction, commit and rollback
	$updates = array(
        'Australia' => 'Dollar',
        'Belgium' => 'Franc'
	$sql ="UPDATE country set currency= ? where country = ?";
	//using transaction
	//default, without transaction 

   	 while (list($id, $name) = each($updates)) {
           		 $intQuery=ibase_execute($intPreQuery, $name, $id);
   	// always commit if using transaction
	// transaction could be more powerful in sql script running in database backend engine 
    	echo "Done!";
Return current item: metafire