The method select_gen is just calling the mysql_query method:
Code: Select all
function select_gen($req,$con){
$reponse=mysql_query($req,$con)
or die("Query Error");
return $response;
}
Code: Select all
//Creating the object and the connection
$db = new Database();
$con = $db->connect();
//formatting the query
$string = mysql_real_escape_string($string);
$sql = "SELECT * FROM sg_content as t1 WHERE t1.content_name LIKE '%".$string."%' OR t1.content_des LIKE '%".$string."%' ORDER BY t1.content_id";
[b]/* This works! */[/b]
$result = mysql_query($sql,$con);
[b]/* This doesnt throw an error but return an empty result */[/b]
$result = $db->select_gen($sql,$con);
$db->close($con);
Why? I dont understand... im just passing a variable in parameter to do the exact same treatment... please help me!