I have a script to insert values into a database and then once done passes a header to a page where it checks for blank values in a certain column and returns them on the page which I will later make editable so they can be updated.
The problem I'm having is when I'm running the query its not returning the cells with the blank values.
$sql = "SELECT * FROM `data` WHERE `team`=''";
$result = mysql_query($sql, $conn);
if(!$result) {
echo "Cannot do query" . "<br/>";
exit;
}
$row = mysql_fetch_row($result);
$count = $row[0];
$each_results = mysql_fetch_row($result);
for ($i=0; $i<$each_results; $i++) {
$row = mysql_fetch_assoc ($result);
echo $row['rep_num'] . " " ;
echo $row['team'] . " ";
echo $row['description'] . "</br>";
}
I tried SELECT * FROM data
and it returned all the results including the results with no team value. I ran the SELECT * FROM data
WHERE team
='' query in phpmyadmin and it did return the rows I expected it to with the missing cell data from the team row. So I guess its something wrong with my for loop at the bottom.
Thank you in advanced for your help.