Hello, I have the code below and I'm having a problem checking the returned values from the query i send,i really would like to know how to check each and every row the query return if it contains null values.And if it does contain the null values to update another row of that same record
Thank you

<?php
include("connection.php");
$query = mysql_query("SELECT * FROM 'table' ");
while ($row = mysql_fetch_array($query))
{
$serie=$row["serie"];
$numero=$row["number"];
$status=$row["status"];
$date=$row["date"];
$id=$row["id"];
}
?>
 <?php 
   $data = mysql_query("SELECT * FROM sim"); 

   Print "<table width='0' border='0'>";
   Print "<th align='left'>N&uacute;mero de Serie</th>";
   Print "<th align='left'>N&uacute;mero de Telem&oacute;vel</th>";
   Print "<th align='left'>Estado</th>";
   Print "<th align='left'>Operadora</th>";
   Print "<th align='left'>Registo</th>";
   Print"<tr class='even'>";
	Print"<td>".$row['serie'] . "</td> ";
	Print"<td>".$row['number'] . "</td> ";
	Print"<td>".$row['status'] . "</td> ";
	print"</tr>"; 	
   
	Print "</table>";
?>

Recommended Answers

All 3 Replies

Then instead of selecting ALL the records, select only the ones that are null:

SELECT * FROM `tableName` WHERE `columnName` IS NULL

Then instead of selecting ALL the records, select only the ones that are null:

SELECT * FROM `tableName` WHERE `columnName` IS NULL

Tha faar i know but the problem is that i have at least 4 columns and for each do i have to run a query ?

No. You can use OR to determine if at least one of them is null: SELECT * FROM `tableName` WHERE (`column1` IS NULL) OR (`column2` IS NULL) OR (`column3` IS NULL) OR (`column3` IS NULL) , etc. Just change column# with the actual names of your columns

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.