Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-Type: text/xml'); # create header
- error_reporting(E_ALL);
- $dbhost = "localhost";
- $dbuser = "alf5525";
- $mysqli = new mysqli($dbhost,$dbuser,*******,$dbUser);
- echo "<xml>";
- getDescription($mysqli);
- function getDescription($mysqli)
- {
- $sql = "SELECT * FROM TableInfo WHERE DataID = '1'";
- if ($result = $mysqli->query($sql))
- //got a result
- //work with the results
- echo "<tr> <td> there were ".$result->num_rows." rows </td></tr>\n";
- if ($result->num_rows >0)
- {
- //build up the rows in the table
- while ($row = $result->fetch_object())
- {
- $desc = $row->description;
- echo "<description>\n";
- echo "$desc \n";
- echo "</description>";
- }
- }
- else { //error with the submitted query
- echo "no results";
- }
- }
- echo "</xml>";
- $mysqli->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement