This script here by GeekFish can get you empty/null fields in a table. It however outputs the results in an array format and repeats itself. Eg. Array ( [0] => Field “5” on entry “1” is empty/null [1] => Field “price” on entry “1” is empty/null. I only need the results in the odd number arrays [1],[3],[5].. and print them to a modal form. Thanks.
$sql = "SELECT * FROM TABLE_PRODUCTS";
$res = mysql_query($sql);
$emptyFields = array();
while ($row = mysql_fetch_array($res)) {
foreach($row as $key => $field) {
if(empty($field)) {
$emptyFields[] = sprintf('Field "%s" on entry "%d" is empty/null', $key, $row['table_primary_key']);
}
}
}print_r($emptyFields);
Thats not really a good script, why not only return data that has fields that are empty or null in the SQL statement?
Also, what do you mean by only odd rows? do you mean you want to skip every other row? if so this ‘should’ work:
let me know if you meant something else