Jump to content

Does Anyone Know What This Means?


j3rmain3

Recommended Posts

I am trying to display dynamic graphs using LibChart, PHP and MySQL. I not very sure whether i could use LibChart with MySQL so i am trying to find out but when i program it all in PHP i get this error, and have no idea what is means.

ERROR in query: Resource id #15.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #15' at line 1

Can anyone help?

J3rmain3
Link to comment
Share on other sites

Sorry about that.

Here is the coding

[code]<html>
<head>
<title>Goals Per Game</title>
<h3>Goals Per Game</h3>
<meta http-equiv ="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>

<?php

include "libchart/libchart/libchart.php";

$host = "localhost";
$user = "root";
$pass = "mysql";
$db = "goals";

$connection = mysql_connect($host,$user,$pass) or die ("Unable To Connect To Server"); #connect to server

mysql_select_db($db) or die ("Unable To Get Database"); #connect to database

$query = mysql_query("SELECT * FROM goals_data"); #select all fields from table

$result = mysql_query($query) or die ("ERROR in query: $query.".mysql_error());#run the query

$numplayers = mysql_num_rows($query);

#START CREATING THE CHART

$chart = new verticalChart();

for ($i=0; $i<=($query);$i++) {

$chart ->addPoint(new Point("f_name, $l_name", "$goals"));

}
$chart ->setTitle("Results From PowerDrive Field Test");
$chart ->render("graphs/powerDrive.png");

?>

<img alt="PowerDrive Report" src="graphs/PowerDrive.png" style="border: 1px solid black;" />

</body>
</html>
[/code]

If you find more errors than just the problem i have stated can you please inform me. thery may be quite a bit because i was just choopping and adding things to try and get it to work

Thanks

J3rmain3
Link to comment
Share on other sites

You tryed to do the query twice. once using

$query = mysql_query("SELECT * FROM goals_data"); #select all fields from table

making $query the Resource result then you tried to query the database again with it which wouldn't work. Then you tried to count the rows with the $query instead of what will now be the $result. It wasn't failing on that bit at that time, however once you would have sorted that it would have failed there as well anyway.

$result = mysql_query($query) or die ("ERROR in query: $query.".mysql_error());#run the query
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.