Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2.    header('Content-Type: text/xml');  # create header
  3.  
  4.    $dbhost = "localhost";
  5.    $dbuser = "alf5525";
  6.    
  7.    $mysqli = new mysqli($dbhost,$dbuser,*******,$dbUser);
  8.    
  9.    echo "<xml>";
  10.    
  11.     getDescription($mysqli);
  12.  
  13.     $mysqli->close();
  14.    
  15.    
  16.    
  17.    function getDescription($mysqli)
  18.    {
  19.    $sql = "SELECT description FROM  TableInfo WHERE  DataID = 1";
  20.     if ($result = $mysqli->query($sql))
  21.      //got a result
  22.         //work with the results
  23.         echo "<tr> <td> there were ".$result->num_rows." rows </td></tr>\n";
  24.         if ($result->num_rows >0)
  25.         {
  26.            
  27.             //build up the rows in the table
  28.             while ($row = $result->fetch_object())
  29.             {
  30.                 $desc = $row->description;
  31.                
  32.                
  33.                 echo "<description>\n";
  34.                 echo "$desc \n";
  35.                 echo "</description>";
  36.                
  37.             }
  38.        
  39.         }  
  40.     }
  41.    
  42.    
  43.    echo "</xml>";
  44.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement