mysqli using row count to create percentage <divs> from query -


i trying create visual representation of small survey has 3 possible answers in mysqli. have created 3 separate recordsets, , tried record count each, turning results graphical display. not working, , hoping can point out error(s) mysqli...

    <?php $recordset2 = new wa_mysqli_rs("recordset1",$sig4,0); $recordset2->setquery("select * survey_smoking smoking_allowed 'in%'"); $designated->num_rows; $recordset2->execute(); ?> <?php $recordset1 = new wa_mysqli_rs("recordset2",$sig4,0); $recordset1->setquery("select * survey_smoking smoking_allowed 'everywhere%'"); $allowed->num_rows; $recordset1->execute(); ?> <?php $recordset3 = new wa_mysqli_rs("recordset3",$sig4,0); $recordset3->setquery("select * survey_smoking smoking_allowed 'no%'"); $forbidden->num_rows; $recordset3->execute();?> 

and trying use thre simple divs show results...

<div style="width: <?php echo($allowed); ?>%; background-color: lightgreen"> <strong>smoking allowed (<?php echo($allowed); ?>)</strong> </div> <div style="width: <?php echo($designated); ?>%; background-color: lightyellow"> <strong>designated areas (<?php echo($designated); ?>)</strong> </div> <div style="width: <?php echo($forbidden); ?>; background-color: lightblue"> <strong>smoking forbidden (<?php echo($forbidden); ?>)</strong> </div> 

it seems overthinking problem, simple code below gave me needed. must have been asking stackoverflow , google wrong questions because didn't find (or missed) answer listed anywhere, thought add it.

$recordset1->totalrows 

so simple!


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -