Guest User

Untitled

a guest
Jan 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1.  
  2. //if you want to require one of them
  3. if(trim($_REQUEST['username']) || $_REQUEST['date'] || $_REQUEST['employee'])
  4. {
  5.  
  6. $dbhost = "localhost";
  7. $dbuser = "root";
  8. $dbpass = "p4ssw0rd";
  9. $dbname = "webcall";
  10. //Connect to MySQL Server
  11. mysql_connect($dbhost, $dbuser, $dbpass);
  12. //Select Database
  13. mysql_select_db($dbname) or die(mysql_error());
  14. // Retrieve data from Query String
  15.  
  16.  
  17. $where="";
  18.  
  19. $query = "SELECT * FROM LS_webcall";
  20. if(trim($_REQUEST['username']))
  21. $where.= " and webcall_username='" . mysql_real_escape_string($_REQUEST['username']) ."' ";
  22.  
  23. if(trim($_REQUEST['startdate']))
  24. $where.= " and `webcall_date >= STR_TO_DATE('" . mysql_real_escape_string($_REQUEST['startdate']) ."','%b %d %Y') ";
  25.  
  26. if(trim($_REQUEST['enddate']))
  27. $where.= " and `webcall_date >= STR_TO_DATE('" . mysql_real_escape_string($_REQUEST['enddate']) ."','%b %d %Y') ";
  28.  
  29.  
  30. if(trim($_REQUEST['employee']))
  31. $where.= " and webcall_employee='" . mysql_real_escape_string($_REQUEST['employee']) ."' ";
  32.  
  33. if($where!='')
  34. $query.= " where " . trim($where, ' and');
  35.  
  36. $qry_result = mysql_query($query) or die(mysql_error());
  37.  
  38.  
  39. ////////////////BLAH
  40.  
  41. }
  42. else
  43. die('submit something');
Add Comment
Please, Sign In to add comment