Advertisement
michaelyuen

Untitled

Feb 12th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. if (ISSET($_POST['searchBtn'])) {
  2.     if (!EMPTY($_POST['reason']) || !EMPTY($_POST['regions']) || !EMPTY($_POST['print'])) {
  3.         try {
  4.  
  5.             $sql = "INSERT INTO user(reason, regions, print) VALUES(:reason, :regions, :print)";
  6.             $statement = $db->prepare($sql);
  7.             $statement->execute(array(':reason'=>$reason, ':regions'=>$regions, ':print'=>$print));
  8.  
  9.             if($statement->rowCount()== 1) {
  10.                 $result = flashMessage("inserted successfully");
  11.             }
  12.  
  13.         }   catch(Exception $ex) {
  14.             $result = flashMessage("insertion failed:".$ex->getMessage());
  15.         }
  16.     } else {
  17.         $result = flashMessage("Please select all fields");
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement