I have this situation and I can’t figure out why it is not working. I bet that it is simple, but I just can’t find solution.
This is first file:
$result = query("SELECT name FROM table WHERE something=1 LIMIT 1");
$row = mysql_fetch_row($result);
echo $row[0];
this is query function from second file:
function query($query){
return mysql_query($query) or die (mysql_error());
}
Error I get is:
mysql_fetch_row() expects parameter 1 to be resource, boolean given
@ line where
$row = mysql_fetch_row($result);
is.
So, quite simple, why this is not working like this, and is working when I replace
$result = query("SELECT name FROM table WHERE something=1 LIMIT 1");
with
$result = mysql_query("SELECT name FROM table WHERE something=1 LIMIT 1");
Change the
queryfunction to