Location: PHPKode > projects > Homeless Mangement Information System > hmis/include/mysql_db_connection.inc
<?php
$db_link = mysql_connect ($db_server_address, $db_login , $db_password) OR DIE ("Connection Not Made to DB");

mysql_select_db ($db_name, $db_link) OR DIE ("DB Not Selected");


function run_query ($sql, $error_message)	{
	
	GLOBAL $db_link;
	$query_result = mysql_query ($sql, $db_link);
	if(!$query_result)	{echo "DB SQL Query Error: ".$error_message." ".getenv("SCRIPT_NAME"); exit; }	
	return $query_result;

											}

function fetch_array ($query_result, $error_message, $row_num="")	{

	$row_array =  mysql_fetch_array ($query_result);
	if(!$row_array)	{echo "DB Fetch Array Error: ".$error_message." ".getenv("SCRIPT_NAME"); exit; }
	return $row_array;
																	}

function num_rows ($query_result)	{

	$row_count =  mysql_num_rows ($query_result);
	return $row_count;
									}


function fetch_result ($query_result, $error_message)	{

	$row_result =  mysql_result ($query_result, 0);
	if(!$row_result)	{echo "DB Fetch Result Error: ".$error_message." ".getenv("SCRIPT_NAME"); exit; }
	return $row_result;
														}


function fetch_assoc($query_result, $error_message)	{

	$row_array =  mysql_fetch_assoc ($query_result);
	if(!$row_array)	{echo "DB Fetch Array Error: ".$error_message." ".getenv("SCRIPT_NAME"); exit; }
	return $row_array;
													}




	






?>
Return current item: Homeless Mangement Information System