Location: PHPKode > projects > Blackbeard's Revenge > dbwrapper.php
<?php

include("dbconnect.php");

function db_pconnect($host,$user,$pass){
	$r = mysql_pconnect($host,$user,$pass)
		or die("Could not connect : " . db_error($link));
	if($DEBUG) print "Connected successfully";
	return $r;
}

function db_select_db($dbname){
	$r = mysql_select_db($dbname) 
		or die("Could not select database");
	if($DEBUG) print "Database selection successful";
	return $r;
}

function db_query($sql){
	$r = mysql_query($sql) 
		or die((db_error($link)));
	if($DEBUG) print $sql;
	return $r;
}

function db_fetch_assoc($result){
	$r = mysql_fetch_assoc($result);
		//or die((db_error($link)));	
	return $r;
}

function db_affected_rows($link=false){
	if ($link===false) {
		$r = mysql_affected_rows();
	}else{
		$r = mysql_affected_rows($link);
	}
	return $r;
}

function db_error($link){
	$r = ""; //mysql_error($link);
	return $r;
}

function db_free_result($result){
	$r = mysql_free_result($result);
	if($DEBUG) print "Disconnected successfully";
	return $r;
}

?>
Return current item: Blackbeard's Revenge