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 8198191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:53:59+00:00 2026-06-07T05:53:59+00:00

I have a function; if the function is working url = ambildata.php?akhir=0; is executed

  • 0

I have a function; if the function is working
url = "ambildata.php?akhir=0"; is executed and then do

$query = "SELECT id_hijau, judul, deskripsi, jenis, x, y FROM hijau ORDER BY id_hijau DESC LIMIT 1";

after that

$data = mysql_query($query);

$json = '{"wilayah": {';
$json .= '"petak":[ ';
while($x = mysql_fetch_array($data)){
    $json .= '{';
    $json .= '"id":"'.$x["id_hijau"].'",
        "judul":"'.htmlspecialchars($x["judul"]).'",
        "deskripsi":"'.htmlspecialchars($x["deskripsi"]).'",
        "x":"'.$x["x"].'",
        "y":"'.$x["y"].'",
        "jenis":"'.$x["jenis"].'"

    },';
}
$json = substr($json,0,strlen($json)-1);
$json .= ']';

$json .= '}}';

echo $json;

but i have an error

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\ta\web\ambildata.php on line 13
{“wilayah”: {“petak”:[]}}

please help me solve my problem…

thanks

  • 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-07T05:54:00+00:00Added an answer on June 7, 2026 at 5:54 am

    The query produced an error in stead of results. As noted in the documentation for mysql_query, it will return BOOL false if there is an error. Use mysql_error to see what’s going on.

    EDIT:
    What your error means is that you are passing in either TRUE of FALSE to mysql_fetch_array, which indicates that your $data is either TRUE of FALSE, and since $data = mysql_query($query);, that means mysql_query is returning TRUE or FALSE, and the only time it does that is when there is an error executing the query; it returns false. This means that the real issue is not with mysql_fetch_array, but with your query or elsewhere at the DB level.

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

Sidebar

Related Questions

i have a function like this: function contentDisp() { $.ajax({ url : ../Patient/brest/ros_brest.php, success
i have set in .htaccess Url Rewrite all working just my search function stop
I have this function working <script type=text/javascript> $(window).scroll(function() { if ($(window).scrollTop() == $(document).height() -
I have a recursive function working on a list, the function contains a loop
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div
I am working with datetime objects in python. I have a function that takes
I have a div show hide function which is working fine. when I click
I have created a add input field function which is working fine. I would
I have a javascript function, that works fine if it's anonymous but stops working
I am working on an asp.net MVC 3 application. I have a C# function

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.