MySQL Forums
Forum List  »  PHP

Re: Querying Database to draw a Graph using PHPlot
Posted by: Peter Brawley
Date: December 10, 2012 11:57AM

> There is a error related to the query and the script will not ru

1. To find errors on database calls, add error handling!

eg minimally ...

$conn = mysql_connect($dbhost,$username,$password) or exit( mysql_error() );
...
$r = mysql_query($query) or exit( mysql_error() );

2. The call to mysql_fetch_array(0 throws uses up a row.

3. Fetch calls need to be contingent on what they return eg ...

while( $r = mysql_fetch_row($r) )
$data[] = mysql_fetch_row($r);

Options: ReplyQuote


Subject
Written By
Posted
Re: Querying Database to draw a Graph using PHPlot
December 10, 2012 11:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.