Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <? $sql = "SELECT * FROM calls_engineers WHERE call_ce = '$diary_id'";
  2. $result = mysql_query($sql) or die(mysql_error());
  3. $row2 = mysql_fetch_array($result);
  4. $sql = "SELECT * FROM users WHERE type = 'engineer' ORDER BY first_name";
  5. $result = mysql_query($sql) or die(mysql_error());
  6. while ($row = mysql_fetch_array($result)){ ?>
  7. <div style="width:70px; float:left">
  8. <?
  9. if($row2['engineer_ce'] == $row['id']){
  10. ?>
  11. <input type="checkbox" name="engineer[]" checked="checked" value="<? echo $row['id']; ?>" />
  12. <? echo ' '.$row['first_name'];
  13. } else { ?>
  14. <input type="checkbox" name="engineer[]" value="<? echo $row['id']; ?>" />
  15. <? echo ' '.$row['first_name'];
  16. }?>
  17. </div>
  18. <?
  19. }
  20.  
  21. ?>
  22.  
  23. $row2 = mysql_fetch_array($result);
  24.  
  25. <?
  26.  
  27. $sql = "SELECT * FROM users WHERE type = 'engineer' ORDER BY first_name";
  28. $result = mysql_query($sql) or die(mysql_error());
  29. while ($row = mysql_fetch_array($result)){ ?>
  30.  
  31. <div style="width:70px; float:left">
  32. <input type="checkbox" name="engineer[]" <?
  33. $result2 = mysql_query("SELECT * FROM calls_engineers WHERE call_ce = '".mysql_real_escape_string($diary_id)."' AND engineer_ce = ".$row['id']);
  34. if(mysql_num_rows($result2) > 0) echo 'checked="checked"';
  35. ?> value="<? echo $row['id']; ?>" />
  36. <? echo ' '.$row['first_name']; ?>
  37. </div>
  38.  
  39. <? } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement