Validating against DB
I have a total number of people allowed in a class... I would like to have the class disappear from the dynamic drop down based on wether the count is <= 25...
This is what I have so far, I'm thinking there's an easier way using our WA tools...
<?php
do {
?>
<option value="<?php echo $row_ClassDetails['CDID']; ?>" >
<?php
$mysqldate = $row_ClassDetails['CDDate'];
$mydate = date("M, d Y",strtotime($mysqldate));
echo $mydate;
?> -
<?php echo $row_ClassDetails['CDName']; ?> -
<?php
$cdid = $row_rtnUser['CDID'];
$sql = "SELECT COUNT(CDID) AS total FROM rtnUser WHERE CDID = $cdid";
$query = mysql_query($sql);
$recordset = mysql_fetch_assoc($query);
$count = $recordset["total"];
echo "$count";
?> of <?php echo $row_ClassDetails['CDMaximum']; ?> max.
</option>
<?php
} while ($row_ClassDetails = mysql_fetch_assoc($ClassDetails));
?>
This returns a "1" for all of the 7 classes.
The first class has a single user, the rest have 0...
Any help would be great!
Ted