j3rmain3 Posted October 2, 2006 Share Posted October 2, 2006 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 1Can anyone help?J3rmain3 Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/ Share on other sites More sharing options...
steveclondon Posted October 2, 2006 Share Posted October 2, 2006 can you put some code up it will be a great help Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102201 Share on other sites More sharing options...
wildteen88 Posted October 2, 2006 Share Posted October 2, 2006 Looks like you are passing the wrong variable or something. Post your code here that corresponds to that error being returned. Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102202 Share on other sites More sharing options...
j3rmain3 Posted October 2, 2006 Author Share Posted October 2, 2006 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><?phpinclude "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 servermysql_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 workThanksJ3rmain3 Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102207 Share on other sites More sharing options...
steveclondon Posted October 2, 2006 Share Posted October 2, 2006 $numplayers = mysql_num_rows($query);this should be$numplayers = mysql_num_rows($result); Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102208 Share on other sites More sharing options...
j3rmain3 Posted October 2, 2006 Author Share Posted October 2, 2006 The error message still appears, and it still says the exact same thing.J3rmain3 Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102212 Share on other sites More sharing options...
steveclondon Posted October 2, 2006 Share Posted October 2, 2006 opps sorry didn't see that above. $query = mysql_query("SELECT * FROM goals_data");This should also be$query = "SELECT * FROM goals_data"; Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102214 Share on other sites More sharing options...
steveclondon Posted October 2, 2006 Share Posted October 2, 2006 You tryed to do the query twice. once using$query = mysql_query("SELECT * FROM goals_data"); #select all fields from tablemaking $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 Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102216 Share on other sites More sharing options...
j3rmain3 Posted October 2, 2006 Author Share Posted October 2, 2006 Yeah, i just realised that aswellThanks alot for the helpJ3rmain3 Quote Link to comment https://forums.phpfreaks.com/topic/22724-does-anyone-know-what-this-means/#findComment-102217 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.