Hey I am having issues with my code, the user.title does not seem to be working right, the code is not passing my log in. Here is my code:
public function isGroupMember($id)
{
global $conn;
$sql = "SELECT user.title, Groups.* FROM user INNER JOIN Groups ON user.title = Groups.Group_ID
WHERE
user_id='" . fixstr($this->user_id) . "'
AND
user.title='" . fixstr($db->mysql_escape($id)) . "'
LIMIT 1
";
if(getnum($sql) > 0) {
return true;
} else {
return false;
}
}
The way that the code was previously written:
user.title = '".$db->sql_escape($db->sql_escape($id))."'
Where it says user.title the code in parenthesis is set incorrectly the is no mysql_escape used in this code:
fixster code:
function fixstr($str){
$str = trim($str);
$str = str_replace("'", "''", $str);
return $str;
}
getnum:
function getnum($sql)
{
global $conn;
$result1 = mysql_query($sql);
if($result1){
$row1 = mysql_fetch_array($result1);
$num = $row1["num"];
return $num;
}
}
What would be the fix to my code?