Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.30 KB | None | 0 0
  1.   /*case 'ext':
  2.     /* search code using phone extension */
  3.  
  4.   /* select data from PHONES table
  5.   $sql = "SELECT * FROM phones WHERE ";
  6.   $ext = $search_string;
  7.  
  8.   for ($x = 1; $x <= 4;  x++) {
  9.     $sql .= "ext$x = \'$ext\' || ";
  10.   }
  11.  
  12.   $sql = substr($sql, 0, -4);
  13.  
  14.   echo $sql;
  15. //    $sql .="ext = " . $ext ."";
  16. /*
  17.   $sql = "SELECT * FROM phones WHERE ext = " . $uid . "";      
  18.  
  19.   $result = mysql_query($sql, $conn);
  20.   if (!$result) {
  21.      die("<b>ERROR:</b> Unable to select user's phone information." . mysql_error());
  22.   }
  23.  
  24.   while($row = mysql_fetch_array($result))
  25.      {
  26.         $phone_ip = $row['phone_ip'];
  27.         $phone_model = $row['model'];
  28.         $phone_type = $row['type'];
  29.         $phone_ext1 = $row['ext1'];
  30.         $phone_ext2 = $row['ext2'];
  31.         $phone_ext3 = $row['ext3'];
  32.         $phone_ext4 = $row['ext4'];  
  33.         $cable_id = $row['cable_id'];
  34.         $location_id = $row['lid'];
  35.      }
  36.  
  37.   /* select data from USERS table
  38.   $sql = "SELECT * FROM users WHERE lid= '$search_string'";
  39.  
  40.   $result = mysql_query($sql, $conn);
  41.   if (!$result) {
  42.      die("<b>ERROR:</b> Unable to select Location ID." . mysql_error());
  43.   }
  44.  
  45.   $num_rows = mysql_num_rows($result);
  46.  
  47.   while($row = mysql_fetch_array($result))
  48.      {
  49.         /* grab identifiers
  50.         $uid = $row['uid'];
  51.         $first = $row['first'];
  52.         $last = $row['last'];
  53.         $user = $row['username'];
  54.         $password = $row['password'];
  55.         $title = $row['title'];
  56.         $cell_phone = $row['cell_phone'];
  57.         $cell_type = $row['cell_type'];
  58.         $printer1 = $row['printer1'];
  59.         $printer2 = $row['printer2'];
  60.         $pc_name = $row['pc_name'];
  61.         $cell_number = $row['cell_number'];
  62.         $full_name = $first . " " . $last;
  63.      }
  64.          
  65.   /* select data from NETWORK table
  66.     $sql = "SELECT * FROM network WHERE uid = " . $uid . "";
  67.  
  68.     $result = mysql_query($sql, $conn);
  69.     if (!$result) {
  70.        die("<b>ERROR:</b> Unable to select user's network information." . mysql_error());
  71.     }
  72.    
  73.     while($row = mysql_fetch_array($result))
  74.        {
  75.           $lid = $row['lid'];
  76.           $equpment_type = $row['equipment_type'];
  77.           $equipment_func = $row['equipment_func'];
  78.           $cableid = $row['cable_id'];
  79.        }
  80.  
  81.   break;*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement