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

  • Home
  • SEARCH
  • 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 8322419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:22:58+00:00 2026-06-08T23:22:58+00:00

I have an error like this : Warning: mysql_fetch_array() expects parameter 1 to be

  • 0

I have an error like this :

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\lab\try.php on line 40

The query is :

$graphquery = mysql_query ("SELECT
  $cluster,
  SUM(IF(idx=3,1,0)) AS green,
  SUM(IF(idx=2,1,0)) AS yellow,
  SUM(IF(idx=1,1,0)) AS red
FROM (SELECT
        $cluster
        $xcond
        ,LEAST(999 $acond) idx 
      FROM table
      WHERE date >= '". $startDate ."'
          AND date <= '". $endDate ."'
          AND $regional = '$gregcond'
          AND $latitude IS NOT NULL 
      GROUP BY $cluster, $lac, $mainid
      HAVING $cluster IS NOT NULL
$paraxcond
      ) A
GROUP BY $cluster");

If I echo the query, it will be like this (no error, perfect result too btw) :

SELECT
  cluster,
  SUM(IF(idx=3,1,0)) AS green,
  SUM(IF(idx=2,1,0)) AS yellow,
  SUM(IF(idx=1,1,0)) AS red
FROM (SELECT
        cluster,
        ROUND(AVG(some_value_Index))    some_value_Index,
        LEAST(999, AVG(some_value_Index) )    idx
      FROM TABLE
      WHERE tanggal >= '2012-07-10'
          AND tanggal <= '2012-08-02'
          AND Regional = 'Regional_Example'
          AND Latitude IS NOT NULL
      GROUP BY cluster, Lac, ID
      HAVING cluster IS NOT NULL
          AND some_value_Index IN(3,2,1)) A
GROUP BY cluster

When I add mysql_error on that script, it sounds like this :

Incorrect parameter count in the call to native function 'LEAST'

And here is how I willing to use the MYSQL Query :

$row = mysql_fetch_array ($graphquery)

When I am ECHO the query and try it on SQLYOG or PHPMYADMIN there is no error contained, so Can anyone tell me where is the error please?

  • 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-08T23:23:00+00:00Added an answer on June 8, 2026 at 11:23 pm

    You missed a comma in the LEAST() function. LEAST expects 2 or more parameters. So the query will be.

    mysql_query ("SELECT
      $cluster,
      SUM(IF(idx=3,1,0)) AS green,
      SUM(IF(idx=2,1,0)) AS yellow,
      SUM(IF(idx=1,1,0)) AS red
    FROM (SELECT
            $cluster
            $xcond
            ,LEAST(999, $acond) idx 
          FROM table
          WHERE date >= '". $startDate ."'
              AND date <= '". $endDate ."'
              AND $regional = '$gregcond'
              AND $latitude IS NOT NULL 
          GROUP BY $cluster, $lac, $mainid
          HAVING $cluster IS NOT NULL
    $paraxcond
          ) A
    GROUP BY $cluster");
    

    I changed LEAST(999 $acond) to LEAST(999, $acond)

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

Sidebar

Related Questions

I have many errors in my apache error log like this: [Mon Mar 26
I have an error in Hibernate 4.1.2.FINAL, JBoss 7.1.1,and Spring 3.1.0.RELEASE,like this: 12:10:50,853 ERROR
I have dialog created like this $('#add_error').click(function(e) { $('<div>') .load('/someaction/format/html/') .dialog({ title: 'Some title',
Let's say that I have a method that looks like this: def raise_if_client_status_error(xml_resp) #
I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
Hi I have created a setDecorator() which is something like this: $timeSu->setDecorators(array('ViewHelper', 'Description', 'Errors',
I have written a tool tip snippet, its throwing error like TOO MUCH RECURSION
I have a bunch of ajax calls that contain success and error conditions like
I have created Controller Attribute and would like to read SessionId but get error
I have a class which is in charge for error handling. I would like

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.