Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?php
  2. $con = mysql_connect("localhost", "hmv", "2206");
  3. $database = 'kingfisher';
  4.  
  5. mysql_select_db($database, $con);
  6.  
  7. $result = mysql_query("SELECT * FROM records ORDER BY restaurant asc");
  8.  
  9. while($row = mysql_fetch_assoc($result)) {
  10.     //print_r($row);
  11.  
  12.     $restaurant_name = $row['restaurant'];
  13.     $restaurant_address = $row['address'];
  14.     $telephone = phone($row['phone_number1'], $row['phone_number2'], $row['phone_number3'], $row['phone_number4']);
  15.     $avg_meal = str_replace("Rs.", "", $row['avg_meal']);
  16.     $cuisine = cuisine($row['cuisine ']);
  17.  
  18.     echo "$restaurant_name $restaurant_address $telephone $avg_meal <br/>";
  19.  
  20. }
  21.  
  22. // Creates a Slug of the Name
  23. function slug($string) {
  24.     $string = strtolower(trim($string));
  25.     $string = preg_replace('/[^a-z0-9-]/', '-', $string);
  26.     $string = preg_replace('/-+/', "-", $string);
  27.     return $string;
  28. }
  29.  
  30. // Returns an Array of Telephone numbers
  31. function phone($phone1, $phone2, $phone3, $phone4) {
  32.     $telephone = array();
  33.  
  34.     if($phone1) {
  35.         $telephone[] = $phone1;
  36.     }
  37.     if($phone2) {
  38.         $telephone[] = $phone2;
  39.     }
  40.     if($phone3) {
  41.         $telephone[] = $phone3;
  42.     }
  43.     if($phone4) {
  44.         $telephone[] = $phone4;
  45.     }
  46.     $telephone = implode(",", $telephone);
  47.  
  48.     return $telephone;
  49. }
  50. global $cui;
  51.  
  52. $cui = "aa";
  53. function cuisine($cuisine) {
  54.     global $cui;
  55.     echo "$cui aa";
  56. }
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement