How can I count the number of columns in a record (row) that have data stored in them? I periodically need this information to advise users of how many more entries they can make in their record.
<? $result = mysql_query ("SELECT * from table"); while ($row = mysql_fetch_assoc ($result)) { $count = 0; foreach ($row as $value) { if (!$value) {$count++;} } echo "This row has $count empty fields<br>"; } ?>
Excellent!