Warning: mysql_query() expects parameter 2 to be resource, null given in Z:\home\localhost\www\sayt\index.php on line 3
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in Z:\home\localhost\www\sayt\index.php on line 4
<?php
include ("blocks/bd.php");
$result = mysql_query("SELECT title,meta_d,meta_k,text FROM settings WHERE page='index'",$db);
$myrow = mysql_fetch_array($result);
?>
Where do you do your mysql_connect(), presumably assigning the result to $db? Did you verify it worked before trying to use it later?
Assuming it was supposed to be done in the block/bd.php file, is that the correct file name? Should it be require()'d instead of include()'d in order to be positive it gets loaded?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Don't use the @ symbol. It only suppresses errors, it does nothing to resolve them (in fact it makes them harder to resolve since it hides the error messages meaning you can't find where it went wrong).
What needs to be checked is that $db is properly being assigned to a mysql connection resource. One thing i notice is that your file I would assume is where mysql_connect is, is named bd.php not db. If $db is not assigned to something it will be null (hence the error). One that's null the query funtion fails to even execute because of invalid parameters, meaing $result will be undefined. Since its undefined, you get the second error as you end up passing null to mysql_fetch_array.
Note: The entire mysql_* extension is marked for deprecation and it is strongly suggested you use PDO or mysqli_* instead.
Bookmarks