Jump to content

If row doesnt exist


flemingmike

Recommended Posts

hello, i am having an issue with tables using incorrect data.

 

i have 2 columns, first is employee name, second is location

 

if the employee doesnt have a location for the current day, it is telling me he is at the same location as the guy in the row above him.  i need this to be blank.  is this possible?

Link to comment
https://forums.phpfreaks.com/topic/217762-if-row-doesnt-exist/
Share on other sites

here it is:

 

$result9 = mysql_query("SELECT * FROM staff ORDER BY name");
while($row9 = mysql_fetch_array($result9))
{
$peid=$row9['eid'];
$pname=$row9['name'];

$result4 = mysql_query("SELECT * FROM schedule WHERE eid = '$peid' ORDER BY id DESC LIMIT 1");
while($row4 = mysql_fetch_array($result4))
{

  $sstatus=$row4['status'];


if("$sstatus" == "1") {
$sstatusout="<font color='#0000FF' size='4'>Waiting For Arrival</font>";
 }  

if("$sstatus" == "2") {
$sstatusout="<font color='#00FF00' size='4'>Signed In</font>";
 }  

if("$sstatus" == "3") {
$sstatusout="<font color='#FF0000' size='4'>Signed Out</font>";
 } 

}


  echo "<tr>";
  echo "<td align='center'>" . $pname . "</td>";
  echo "<td align='center'>";
     if(empty($sstatusout) ) {

 } else {
 echo "" . $sstatusout . "";
 }
echo "</td>";

  
  
  
  echo "</tr>";
  
  }
echo "</table>";

Link to comment
https://forums.phpfreaks.com/topic/217762-if-row-doesnt-exist/#findComment-1130347
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.