Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2.  
  3. // model
  4. require_once 'db_config.php';
  5.  
  6. class Model{
  7. function _construct($host, $user, $pass, $dbname){
  8. global $host, $user, $pass, $dbname, $conn, $db;
  9. //$host = "localhost";
  10. //$user = "root";
  11. //$pass = "";
  12. //$dbname = "komcua";
  13. $conn = mysql_connect($host, $user, $pass) or die(mysql_error());;
  14. $db = mysql_select_db($db_name);
  15. }
  16.  
  17. function getCityCode( $location ){
  18. $query = "SELECT * FROM citycode WHERE CityName LIKE '" . $location . "'";
  19. $result = mysql_query($query);
  20. if(!$result){
  21. $row = mysql_result( $result, 1);
  22. return $row;
  23. }
  24. else{
  25. echo mysql_error();
  26. return false;
  27. }
  28.  
  29. }
  30. }
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement