<?php

    $W 
400;        # Breite
    
$H 150;        # Hoehe
    
$OX 10;        # Urpsrung X
    
$OY 10;        # Urpsrung Y
    
$PL =  3;           # Pfeillaenge fuer Koordinatenkreuz
    
$LW =  6;           # Balkenstaerke

    
Header"Content-type: image/jpg");

    
putenv"ORACLE_SID=ora10g");
    
putenv"ORACLE_HOME=/soft/oracle-10.1.0.3");

    
$dbc dbx_connect(
                
DBX_OCI8,
                
"localhost",
                
"ora10g",
                
"feyrer",               // User
                
"feyrer"                // Password
                
)
                or die;
    
// ora_commitoff($dbc);

    
$query =  "SELECT * FROM gdora";
    
$result dbx_query($dbc$query,
    
DBX_RESULT_ASSOC|DBX_RESULT_UNBUFFERED) or die;

    
$image imagecreate($W$H);
    
$red ImageColorAllocate($image,255,0,0);
    
$blue ImageColorAllocate($image,0,0,255);
    
$black ImageColorAllocate($image,0,0,0);
    
$white ImageColorAllocate($image,255,255,255);
    
ImageFilledRectangle($image,0,0,$W,$H,$white);

    
# Koordinatenkreuz malen
    
ImageLine($image0$H-$OY$W,$H-$OY$black);     # X-Achse
    
ImageLine($image$W$H-$OY$W-$PL$H-$OY-$PL$black);
    
ImageLine($image$W$H-$OY$W-$PL$H-$OY+$PL$black);

    
ImageLine($image$OX$H$OX0$black);        # Y-Achse
    
ImageLine($image$OX0$OX-$PL$PL$black);
    
ImageLine($image$OX0$OX+$PL$PL$black);

    
# Daten aus Tabelle holen und malen
    
while($coords dbx_fetch_row($result)) {
    
ImageFilledRectangle($image,
                 
$OX $coords["X"] - $LW$H-$OY-$coords["Y"],
                 
$OX $coords["X"] + $LW$H-$OY,
                 
$red);
    
ImageLine($image,
          
$OX $coords["X"], $H-$OY,
          
$OX $coords["X"], $H-$OY-$coords["Y"],
          
$blue);
    }

    
ImageJPEG($image);
    
ImageDestroy($image);

    
dbx_close($cursor);

    
?>