-1

I am trying to create a visual representation of a small survey which has three possible answers in mysqli. I have created three separate recordsets, and then tried to get the record count for each, turning the results into a graphical display. It is not working, and I am hoping someone can point out my error(s)

    <?php
$Recordset2 = new WA_MySQLi_RS("Recordset1",$SIG4,0);
$Recordset2->setQuery("SELECT * FROM SURVEY_SMOKING WHERE SMOKING_ALLOWED LIKE 'IN%'");
$DESIGNATED->num_rows;
$Recordset2->execute();
?>
<?php
$Recordset1 = new WA_MySQLi_RS("Recordset2",$SIG4,0);
$Recordset1->setQuery("SELECT * FROM SURVEY_SMOKING WHERE SMOKING_ALLOWED LIKE 'EVERYWHERE%'");
$ALLOWED->num_rows;
$Recordset1->execute();
?>
<?php
$Recordset3 = new WA_MySQLi_RS("Recordset3",$SIG4,0);
$Recordset3->setQuery("SELECT * FROM SURVEY_SMOKING WHERE SMOKING_ALLOWED LIKE 'NO%'");
$FORBIDDEN->num_rows;
$Recordset3->execute();?>

And then I am trying to use thre simple divs to show the 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>
Dharman
  • 30,962
  • 25
  • 85
  • 135
Bill Teale
  • 159
  • 3
  • 15

1 Answers1

-1

It seems like I was overthinking the problem, the simple code below gave me what I needed. I must have been asking Stackoverflow and Google the wrong questions because I didn't find (or I missed) this answer listed anywhere, so I thought I would add it.

$Recordset1->TotalRows

so simple!

Bill Teale
  • 159
  • 3
  • 15