Location: PHPKode > projects > ClassSimple > functions.php
<?php
/******************************************************
 * functions.php
 * MODULE: None
 *
 * Basic Functions
 ******************************************************/


/*****************************************************
 * SQLite db wrappers
 *****************************************************/
 
function open_db ($file, $line, $filename){
	$error = false;
	
	$result = sqlite_open($filename, 0666, $error);
	
	if ($result === false){
		echo "<b>SQLite Error</b> unable to open databse $filename from $file on line $line: $error";
	}
	
	
	return $result;
}

function query ($file, $line, $db, $query){
	//SQLite query wrapper
	$error = false;
	
	$result = @sqlite_query($db, $query, SQLITE_BOTH, $error);
	if ($result === false){
		echo "<div style=\"border: 3px red solid; background-color: #F66; margin: 7px; padding: 3px;\">";
		echo "<b>SQLite Error</b> in $file on line $line: $error";
		echo "<br>Query: $query</div>";
	}
	return $result;

}

function fetch ($resource){
	return sqlite_fetch_Array($resource);
}

function last_id ($resource){
	return sqlite_last_insert_rowid($resource);
}

?>
Return current item: ClassSimple