Hello all!
I have a problem using my own (mySQL) database classes with JPGraph http://www.aditus.nu/jpgraph/...
Situation:
Configuration:
- Windows 2000 Pro
- Apache 2
- PHP/mySQL
config.php file:
<?php
$db = new mysql_actions;
$db->host = "localhost";
$db->dbase = "***";
$db->username = "***";
$db->password = "***";
$db->connect();
// mySQL database class
class mysql_actions {
var $host;
var $dbase;
var $username;
var $password;
var $CatParent;
var $sql;
function connect() {
$host = $this->host;
$user = $this->username;
$pass = $this->password;
$dbase = $this->dbase;
$this->conn = mysql_connect($host,$user,$pass);
mysql_select_db($dbase) or die ("error...");
}
function query($stmt) {
$ret = mysql_query($stmt,$this->conn);
return $ret;
}
function fetch_object($ret) {
return mysql_fetch_object($ret);
}
}
?>
main index.php file:
<?php
include ("./include/config.php");
?>
..
..
etc...
file graph.php
<?php
include ("jpgraph.php");
include ("jpgraph_bar.php");
$sql = "select * from database where blabla = 'xxx'";
$result = $db->query($sql);
$record = $db->fetch_object($result);
$datay = array($record->field1,....,....,...);
$graph = new Graph($width,$height);
$graph->SetScale("textlin");
...
...
...
$graph->Add($bplot);
$graph->StrokeCSIM("./include/stats/graph.php","graph");
?>
This doesn't work... 🙁
Creating the graph without use of my db classes (so with ex. $result=mysql_query($sql) etc....) does work well.... but I want to use my 'old' classes...
I've read http://www.aditus.nu/jpgraph/jpg_phpoo.php, but I don't really understand how I have to implement this in my db-class so that it works...
Can anyone help?????