Jump to content

if doesnt exist


flemingmike

Recommended Posts

im not sure if i need to rewrite for that.  here is what i have.  can u let me know if i can modify this, or if i should rewrite.

 

$result = mysql_query("SELECT * FROM staff WHERE status = '1' ORDER BY name");
while($row = mysql_fetch_array($result))
{
$id=$row['id'];
$eid=$row['eid'];
$name=$row['name'];


$result4 = mysql_query("SELECT * FROM schedule WHERE date = '$date' AND eid = '$eid'");
while($row4 = mysql_fetch_array($result4))
{

  $sid=$row4['id'];
  $seid=$row4['eid'];
  $sdate=$row4['date'];
  $sjobnumber=$row4['jobnumber'];
  $sstarttime=$row4['starttime'];
  $sstatus=$row4['status'];


if("$sstatus" == "1") {
$sstatusout="<font color='#0000FF' size='4'>Waiting For Arival</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>";
 } 

  
    $sdate1 = date( 'D M j', strtotime($sdate) );
$sstart1 = date( 'g:i A', strtotime($sstarttime) );
$shortid=substr($sjobnumber, 5, -1); //remove the first 5 characters and minus the last character

}	

$result7 = mysql_query("SELECT * FROM timesheet WHERE schednum = '$sid'");
while($row7 = mysql_fetch_array($result7))
{
  $tsid=$row7['id'];
  $tdate=$row7['date'];
  $tjobnumber=$row7['jobnumber'];
  $teid=$row7['eid'];
  $tdescription=$row7['description'];
  $tsignin=$row7['start'];
  $tfinish=$row7['finish'];
  $tlunch=$row7['lunch'];
  $tkms=$row7['kms'];
  $tschednum=$row7['schednum'];
  
  $tdate1 = date( 'M j, Y', strtotime($tdate) );
  
    $tsignin1 = date( 'g:i a', strtotime($tsignin) );
$tfinish1 = date( 'g:i a', strtotime($tfinish) );

if( empty($tfinish) ) {
 $tfinish2="<i>In Progress";
} else {
 $tfinish2="$tfinish1";
}
  
  
  if( empty($tfinish) ) {
 $tfinish2="<i>In Progress";
} else {
 $tfinish2="$tfinish1";
}
  
  }


$result33 = mysql_query("SELECT * FROM jobs WHERE id = '$shortid'");
while($row33 = mysql_fetch_array($result33))
{
  $jcontact=$row33['contact'];
  $jcontactphone=$row33['contactphone'];
  $jaddress=$row33['address'];
  $jcity=$row33['city'];
  $jpostal=$row33['postal'];
  $jprovince=$row33['province'];
  $jcustomer=$row33['customer']; 
  
  $jlocation="$jaddress $jcity $jpostal $jprovince";

  }
  
  
  echo "<tr>";
  echo "<td align='center'>" . $name . "</td>";
  echo "<td align='center'>";
     if ($sjobnumber == 1 ) {

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

  echo "<td align='center'>" . $sstart1 . "</td>";
  echo "<td align='center'>";
     if ($sstatus == 1 ) {

 } else {
 echo "" . $tsignin1 . "";
 }
echo "</td>";
echo "<td align='center'>";
     if ($sstatus == 1 ) {

 } else {
 echo "" . $tfinish2 . "";
 }
echo "</td>";
  echo "<td align='center'>" . $jcustomer . "</td>";
  echo "<td align='center'><a target='_blank' href='http://mapof.it/" . $jlocation . "'>" . $jaddress . "</a></td>";
  echo "<td align='center'>" . $sstatusout . "</td>";
  

  
  }
echo "</table>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.