Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:52:49+00:00 2026-06-01T02:52:49+00:00

Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I’m getting

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:52:51+00:00Added an answer on June 1, 2026 at 2:52 am

    You have an error in the following line

    $sql= mysql_query("SELECT * FROM news_post WHERE block = 0 ORDER BY  post_id DESC
                       LIMIT $offset, $rowsperpage ") or mysql_error();
    

    The function mysql_error() returns a string, so when mysql_query() fails, the $sql variable will contain whatever error was thrown. Later, you tread this string variable as a MySQL resource.

    Instead, what you’re probably trying to do, is to print out whatever string mysql_error() returns and terminate the script. This is usually accomplished with die() in these kinds of scripts.

    So, if you instead use the following, the script will terminate and output the error, should one occur.

    $sql= mysql_query("SELECT * FROM news_post WHERE block = 0 ORDER BY  post_id DESC
                       LIMIT $offset, $rowsperpage ") or die(mysql_error());
    

    Finally, you claim that the above works on your server, but not on localhost, which is not correct. If an error occured on your server, you would get the same behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result This is
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I've this
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result what is
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result okay so
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I have
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result Warning: mysql_fetch_assoc():
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result $err =
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I tried
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I'm having
Possible Duplicate: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.