Revision: 25054
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 18, 2010 15:19 by alib
Initial Code
function dbQuery($query, $identifier=''){ // $identifier for better debugging
GLOBAL $debugMode;
$result=mysql_query($query);
if (!$result) {
$message = 'Invalid query $identifier: ' . mysql_error() . "<br />\n";
if($debugMode) $message .= 'Whole query: ' . $query;
die($message);
}
}
function dbConnect($user, $pass, $db=FALSE, $host='localhost'){
$link=mysql_connect($host,$user,$pass) or die('Could not connect to database: '.mysql_error());
if(!empty($db)) mysql_select_db($db) or die("Could not select the database $db: ".mysql_error());
return $link;
}
function strSafe($str, $char="'"){
return str_replace($char, '\'.$char, $str);
}
Initial URL
Initial Description
Initial Title
functions instead of mysql_query and mysql_connect for error checking with debug mode and function strSafe for stopping sql inje
Initial Tags
Initial Language
PHP