I have the following code which draws a graph
The problem i am having is its not picking up WHERE id = '$propId' because it being included as an image
Does anyone know a way araound this[/code]
| Code: |
|
include('../config/global.php'); // file which holds connection string $maxHeight = $fetch($query('SELECT hits FROM propHits ORDER BY hits DESC')); $qt=mysql_query('SELECT * FROM propHits WHERE propId = "$propId"'); header ("Content-type: image/jpg"); $x_gap=63; // The gap between each point in y axis $x_max=$x_gap*12; // Maximum width of the graph or horizontal axis $y_max=$maxHeight['hits']+60; // Maximum hight of the graph or vertical axis // Above two variables will be used to create a canvas of the image// $im = imagecreate ($x_max, $y_max) or die ("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate ($im, 245, 245, 220); $text_color = imagecolorallocate ($im, 0, 0, 0); $graph_color = imagecolorallocate ($im, 0, 0, 0); $x1=0; $y1=0; $first_one="yes"; while($nt=mysql_fetch_array($qt)){ // echo $nt['month'].', '.$nt['hits']; $x2=$x1+$x_gap; // Shifting in X axis $y2=$y_max-$nt['hits']; // Coordinate of Y axis imagestring($im,2,$x2,$y2-60,round($nt['hits']),$graph_color); imagestring($im,2,$x2,$y_max-15,$nt['month'],$graph_color); //Line above is to print month names on the graph if($first_one=="no"){ // this is to prevent from starting $x1= and $y1=0 imageline ($im,$x1, $y1-40,$x2,$y2-40,$text_color); // Drawing the line between two points } $x1=$x2; // Storing the value for next draw $y1=$y2; $first_one="no"; // Now flag is set to allow the drawing } imagejpeg ($im); |
The problem i am having is its not picking up WHERE id = '$propId' because it being included as an image
| Code: |
| <img src = 'source.php' /> |
Does anyone know a way araound this[/code]
