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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:56:15+00:00 2026-06-01T08:56:15+00:00

I am trying to generate a chart based on the example provided by pchart.

  • 0

I am trying to generate a chart based on the example provided by pchart. Here is my code:

<?php
/* Include the pData class */

include("pchart/class/pData.class.php");

/* Create the pData object */

$myData = new pData();  

/* Connect to the MySQL database */

$db = mysql_connect("webhost", "user", "pass");

mysql_select_db("database",$db);


/* Build the query that will returns the data to graph */

$Requete = "SELECT * FROM `replies` WHERE `field` LIKE CONCAT ('%', Do you an interest in Green IT, '%')";

$Result  = mysql_query($Requete,$db);

$Yes=""; $No=""; $Undecided="";

while($row = mysql_fetch_array($Result));

{


/* Push the results of the query in an array */
$Yes[]   = $row["Yes"];
$No[] = $row["No"];
$Undecided[]    = $row["Undecided"];
}



/* Save the data in the pData array */

$myData->addPoints($Yes,"Yes");

$myData->addPoints($No,"No");

$myData->addPoints($Undecided,"Undecided");

?>

The error I’m getting is this:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a4728588/public_html/charts.php on line 30

Which points to:

while($row = mysql_fetch_array($Result));

Any ideas on how to fix this so the chart is generated?

Thanks in advance

  • 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-01T08:56:17+00:00Added an answer on June 1, 2026 at 8:56 am

    You have syntax error in your query. CONCAT() is for merging strings. Dont need in your query. Should be like this

    LIKE '%Do you an interest in Green IT%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to generate an organization chart in PHP; the classic box above another
I am trying to figure out how to generate a colored chart on a
Im trying to generate a color gradient using ColdFusion. My current code below works
I'm trying to generate a chart via the following url: http://chart.apis.google.com/chart?chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&chxt=x&chbh=a,6,10&chs=320x225&cht=bvg&chco=A2C180&chds=0,95&chd=t:0,0,300,500,0,0,0&chtt=Test The values are
I'm trying to create a relatively complex MySQL query to generate a stacked bar
I'm trying to automatically generate a line chart using VBA and Excel where each
I'm trying to generate sparklines for a dashboard using the Microsoft chart control on
I'm trying to generate a call tree for code I'm working on (I didn't
I am trying to generate a chart using the MS Chart Control in ASP.NET
I'm trying generate a images/chart in my controller and have that image displayed in

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.