<?php /* Model */ include "../model/user.php"; $user = new User; $user_id = $_GET['id']; $result = $user->getUserById($user_id); $locations = $user->getPreferredLocation($user_id); header('Content-Type: text/xml'); $xml = '<user>'; while($row = mysqli_fetch_array($result)){ $xml = $xml . '<name>' . $row['name'] . '</name><username>' . $row['username'] . '</username><email>' . $row['email'] . '</email><image>' . $row['image'] . '</image><phone>' . $row['phone'] . '</phone><driver>' . $row['isDriver'] . '</driver>'; } while($row = mysqli_fetch_array($locations)){ $xml = $xml . '<location>'. $row['location'] .'</location>'; } $result = $user->getDriverRating($user_id); if(mysqli_num_rows($result) > 0){ while($row = mysqli_fetch_array($result)){ $xml = $xml . '<rating>'. $row['driverRating'] .'</rating><votes>'. $row['votes'] .'</votes>'; } } else { $xml = $xml . '<rating>0</rating><votes>0</votes>'; } $xml = $xml . '</user>'; print $xml;