0

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>";
?>
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by hielo
0

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

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

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 ?

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.