renzomassaro Posted September 21, 2007 Share Posted September 21, 2007 Hello, This is my script--> <?php include_once ("jpgraph/src/jpgraph.php"); include_once ("jpgraph/src/jpgraph_bar.php"); include('logindb.php'); $sql = mysql_query("SELECT accommodatie, faciliteiten, ligging, prijs FROM enquete WHERE Park LIKE '%".$_POST['parkres']."%' AND Aankomst BETWEEN STR_TO_DATE('".$_POST['datebox']."','%d-%m-%Y') AND STR_TO_DATE('".$_POST['datebox2']."','%d-%m-%Y')"); while($row = mysql_fetch_array($sql)) { $databar[] = $row['accommodatie']; $databar[] = $row['faciliteiten']; $databar[] = $row['ligging']; $databar[] = $row['prijs']; $legbar[] = $row['']; } error_reporting(E_ALL); $graph = new Graph(250,150,"auto"); $graph->SetScale("int"); $graph->img->SetMargin(50,30,50,50); $graph->SetShadow(); $graph->xaxis->SetTickLabels($legbar); $bplot = new BarPlot($databar); $bplot->SetFillColor("lightgreen"); // Fill color $bplot->value->Show(); $bplot->value->SetFont(FF_ARIAL,FS_BOLD); $bplot->value->SetAngle(45); $bplot->value->SetColor("black","navy"); $graph->Add($bplot); $graph->Stroke(); ?> What I wan't is that the 4 selections only show the '1' files and count them So what I can do is "Select COUNT(accommodatie) AS acc, COUNT(faciliteiten) AS fac" etc but than there have to something in the query to count "acc LIKE 1 AND fac LIKE 1". When I do this there is an MYSQL error... Is there a way that in the WHILE I can give a count on the Selections from the query? Link to comment https://forums.phpfreaks.com/topic/70146-count-as-in-while/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.