Output:
Warning: mysql_query(): 6 is not a valid MySQL-Link resource in C:...\mysql_helper.php on line 94
$con = mysql_connect($GLOBALS['mysql_host'], $GLOBALS['mysql_username'], $GLOBALS['mysql_password']) or die(mysql_error());
$db = mysql_select_db($GLOBALS['mysql_database']) or die(mysql_error($con));
$username=sanitize_mysql($username);
$password=sanitize_mysql($password);
$email=sanitize_mysql($email);
if(check_exists("users", "username", $username) == FALSE){
$query = "INSERT INTO users VALUES('".$username."','".$password."','".$email."','".$status."','".$reg_date."','".$own_ref_id."','')";
$result = mysql_query($query,$con) or die(mysql_error($con));
return TRUE;
} else {
return FALSE;
}
mysql_close($con);
Works in every other function built like this (copy/paste)
This is check_exists
function check_exists($table,$specifier,$value)
{
$con = mysql_connect($GLOBALS['mysql_host'], $GLOBALS['mysql_username'], $GLOBALS['mysql_password']) or die(mysql_error());
$db = mysql_select_db($GLOBALS['mysql_database']) or die(mysql_error($con));
$query = "SELECT * FROM ".$table." WHERE ".$specifier." = '".$value."'";
$erg = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($erg)) {
mysql_close($con);
return TRUE;
}
mysql_close($con);
return FALSE;
}