Forum Moderators: coopster
<?php
// Make a MySQL Connection
$query = "SELECT name FROM owned where type = 'Breastplate'and uid = $uid";
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result)){
echo '<option value="'. $row['name'] .'">'. $row['name'].'</option>';
}
?>
but without using mysql_num_rows and preferrably without using lengthy if statements I would like to verify that the sql actually returns some rows.
Anyone know?
$mydata = ''; // initialize
while($row = mysql_fetch_array($result)){
//echo '<option value="'. $row['name'] .'">'. $row['name'].'</option>';
$mydata .= '<option value="'. $row['name'] .'">'. $row['name'].'</option>';
}
if ($mydata) {
// yes, we processed some rows
}