Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. /* query Cutomer Name */
  2.     if($_POST['txtcustomercode'] != '' && $loaded_customer == false){
  3.         $_SESSION['customercode']   =   $_POST['txtcustomercode']; 
  4.         $loaded_customer = true;
  5.     }
  6.  
  7.     if($loaded_customer){
  8.     /* connect database */
  9.     /* $mysqli = new mysqli($host, $username, $password, $database); */
  10.     $mysqli = new mysqli("localhost", "root", "cpe332", "ticket");
  11.     $mysqli -> set_charset('utf8');         /* set character */
  12.    
  13.     /* select customer detail */
  14.     if ($stmt = $mysqli->prepare("SELECT customercodem,name,telephone FROM customer WHERE customercode = ?")) {
  15.         /* bind parameters to '?' */
  16.         /* i = int , d = double and float, b = blob, s = all other types */
  17.         $stmt   ->  bind_param('s',$_SESSION['customercode']);
  18.        
  19.         /* execute the prepared statement */
  20.         $stmt   ->  execute();
  21.        
  22.         /* Bind results to variables */
  23.         $stmt-> bind_result($customername);
  24.         $stmt-> bind_result($telephone);
  25.        
  26.         /* fetch values */
  27.         while ($stmt->fetch()) {
  28.             $textbox['customername']    =   $customername;
  29.             $textbox['telephone']   =   $telephone;
  30.         }
  31.  
  32.         /* Close the statement */
  33.         $stmt->close();
  34.         $mysqli->close();
  35.         $loaded_customer = false;
  36.     }
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement