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
https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/
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
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.