Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
I'm getting this error message:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /.../.../..../index.php on line 215
Index.php code:
if (isset($_GET['post_id']) && $_GET['post_id'] != '')
{
$p_id = (int) $_GET['post_id'];
$sql= mysql_query("SELECT * FROM news_post WHERE post_id = '$p_id' AND block = 0 LIMIT
$offset, $rowsperpage") or mysql_error();
}
else
{
$sql= mysql_query("SELECT * FROM news_post WHERE block = 0 ORDER BY post_id DESC
LIMIT $offset, $rowsperpage ") or mysql_error();
}
while ($rel = mysql_fetch_assoc($sql)) (Note: this is Line 215)
{
$id = intval($rel['post_id']);
$sub = ucfirst($rel['subject']);
$imgname = htmlentities($rel['img_name']);
$img = htmlentities($rel ['image']);
$msg = $rel['message'];
$date = htmlentities($rel['date']);
$poster = htmlentities($rel['poster']);
$cat_id = intval($rel['cat_id']);
$cat_name = htmlentities($rel['cat_name']);
In my Localhost, it's Ok, it's doesn't show any error message but when up this to my server then it's show error..
What is wrong in my code? can anyone tell me the right direction...
Thanks a lot.