Advertisement
Guest User

irsz.php

a guest
Aug 22nd, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2. header("Content-Type: text/html; charset=UTF-8");  
  3. #header('Content-Encoding: utf-8');
  4. #include('csat.php');
  5.  
  6. /* Connection vars here for example only. Consider a more secure method. */
  7. $dbhost = 'localhost';
  8. $dbuser = 'root';
  9. $dbpass = '';
  10. $dbname = 'customer';
  11.  
  12. $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
  13. mysql_select_db($dbname);
  14.  
  15. $return_arr = array();
  16. /* If connection to database, run sql statement. */
  17. if ($conn)
  18. {
  19.     $fetch = mysql_query("SELECT * FROM telepulesek where IRSZ like '%" . mysql_real_escape_string($_GET['term']) . "%'LIMIT 0,5");
  20.    
  21.     /* Retrieve and store in array the results of the query.*/
  22.     while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
  23.         $row_array['IRSZ'] = $row['IRSZ'];
  24.        
  25.         array_push($return_arr,$row_array);
  26.     }
  27. }
  28.  
  29. /* Free connection resources. */
  30. mysql_close($conn);
  31. /* Toss back results as json encoded array. */
  32. echo json_encode($return_arr);
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement