Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $con = mysql_connect("localhost", "hmv", "2206");
- $database = 'kingfisher';
- mysql_select_db($database, $con);
- $result = mysql_query("SELECT * FROM records ORDER BY restaurant asc");
- while($row = mysql_fetch_assoc($result)) {
- //print_r($row);
- $restaurant_name = $row['restaurant'];
- $restaurant_address = $row['address'];
- $telephone = phone($row['phone_number1'], $row['phone_number2'], $row['phone_number3'], $row['phone_number4']);
- $avg_meal = str_replace("Rs.", "", $row['avg_meal']);
- $cuisine = cuisine($row['cuisine ']);
- echo "$restaurant_name $restaurant_address $telephone $avg_meal <br/>";
- }
- // Creates a Slug of the Name
- function slug($string) {
- $string = strtolower(trim($string));
- $string = preg_replace('/[^a-z0-9-]/', '-', $string);
- $string = preg_replace('/-+/', "-", $string);
- return $string;
- }
- // Returns an Array of Telephone numbers
- function phone($phone1, $phone2, $phone3, $phone4) {
- $telephone = array();
- if($phone1) {
- $telephone[] = $phone1;
- }
- if($phone2) {
- $telephone[] = $phone2;
- }
- if($phone3) {
- $telephone[] = $phone3;
- }
- if($phone4) {
- $telephone[] = $phone4;
- }
- $telephone = implode(",", $telephone);
- return $telephone;
- }
- global $cui;
- $cui = "aa";
- function cuisine($cuisine) {
- global $cui;
- echo "$cui aa";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement