Ankündigung

Einklappen
Keine Ankündigung bisher.

pCHart Diagramm nach SQL-Abfrage lässt sich nicht anzeigen

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • pCHart Diagramm nach SQL-Abfrage lässt sich nicht anzeigen

    Hallo!

    Ich bin neu hier im Forum und bitte um eure Hilfe. Ich sitze schon seit 2 Stunden aber finde den Fehler nicht.

    Aus einer Datenbank werden nach Suche bestimmte Titel ausgespuckt. Ich möchte ein Kreisdiagramm anzeigen und anzeigen lassen, wieviele Treffer man hat und wie das im Verhältnis zu dem gesamten Bestand in der Datenbank ist. Sobald ich den pChart code einfüge geht aber nix mehr ...

    Wisst ihr Rat?


    PHP-Code:
    <?php

    include("../class/pData.class.php");
    include(
    "../class/pDraw.class.php");
    include(
    "../class/pPie.class.php");
    include(
    "../class/pImage.class.php");

    $connection=mysql_connect("localhost","root","") or die ("Verbindungsversuch fehlgeschlagen");
    mysql_select_db("datenbank", $connection) or die("Konnte die Datenbank nicht waehlen.");

    $suche=$_POST["suche"];
    $anzahltreffer=0;
    $sql = "SELECT tags, titel FROM suchbegriffe";

    $adressen_query = mysql_query($sql) or die("Anfrage nicht erfolgreich");
    $anzahl = mysql_num_rows($adressen_query);

    while (
    $adr = mysql_fetch_array($adressen_query))
    {
    $tags=$adr["tags"];
    $asd=explode("#",$tags);
    foreach (
    $asd as $ppp)
    {
        if (
    $ppp == $suche)
        {
               
    $anzahltreffer++;
              echo 
    $anzahltreffer.". Treffer : ".$adr["titel"]."<br />";
        }
    }
    }
    if (
    $anzahltreffer == 0)  echo "Ihre Suchanfrage ergab leider keine Treffer!<br />";


    echo
    "<br /><br /><br />"   ;



    $a= $anzahltreffer/$anzahl;
    $b= 1-$a;

    echo 
    "Anzahl der Treffer = ".$anzahltreffer."<br />";
    echo 
    "Anzahl der Datens&auml;tze gesamte = ".$anzahl."<br />";
    echo 
    "Treffer/Gesamt = ".$a."<br />";
    echo 
    "1-Treffer = ".$b ."<br />";


    echo 
    "<br /><br /><br /><br />";






     
    /* Create and populate the pData object */
     
    $MyData = new pData();
     
    $MyData->addPoints(array($a,$b),"ScoreA");
     
    $MyData->setSerieDescription("ScoreA","Application A");

     
    /* Define the absissa serie */
     
    $MyData->addPoints(array("A","B","C"),"Labels");
     
    $MyData->setAbscissa("Labels");

     
    /* Create the pChart object */
     
    $myPicture = new pImage(240,180,$MyData,TRUE);

     
    /* Set the default font properties */
     
    $myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>10,"R"=>80,"G"=>80,"B"=>80));

     
    /* Create the pPie object */
     
    $PieChart = new pPie($myPicture,$MyData);

     
    /* Enable shadow computing */
     
    $myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));

     
    /* Draw a splitted pie chart */
     
    $PieChart->draw3DPie(120,90,array("Radius"=>100,"DataGapAngle"=>12,"DataGapRadius"=>10,"Border"=>TRUE));

     
    /* Write the legend box */
     
    $myPicture->setFontProperties(array("FontName"=>"../fonts/Silkscreen.ttf","FontSize"=>6,"R"=>0,"G"=>0,"B"=>0));
     
    $PieChart->drawPieLegend(140,160,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));

      
    /* Render the picture (choose the best way) */
     
    $myPicture->autoOutput("pictures/example.draw3DPie.transparent.png");

    ?>

  • #2
    Kann an dem Code erstmal keine Fehler erkennen (außer, dass er schlecht ist)... in diesem Sinne:

    http://www.php.de/php-einsteiger/543...produkten.html

    Kommentar


    • #3
      Und „geht nicht“ ist keine sinnvolle Fehlerbeschreibung.

      - http://phpforum.de/forum/showthread.php?t=216988
      - http://www.php.de/wiki-php/index.php...ging:Leitfaden

      Oh, sorry, war der Thread doch schon so alt.

      Kommentar

      Lädt...
      X