Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-type: name/xml");
- $host = "localhost";
- $user = "root";
- $pass = "Briker";
- $database = "phonebook";
- $ext = "ext";
- $linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
- mysql_select_db($database, $linkID) or die("Could not find database.");
- $query = "SELECT name,number FROM phonebook limit 20";
- $resultID = mysql_query($query, $linkID) or die("Data not found.");
- $xml_output = "<?xml version=\"1.0\"?>\n";
- $xml_output .= "<Screen>\n";
- for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
- $row = mysql_fetch_assoc($resultID);
- $xml_output .= "\t<PhoneBook>\n";
- $xml_output .= "\t<Personel>\n";
- $xml_output .= "\t\t<Name>" . $row['name'] . "</Name>\n";
- $xml_output .= "\t<PhoneNums>\n";
- $xml_output .= "\t\t<PhoneNumstype=$ext>" . $row['number'] . "</PhoneNums>\n";
- $xml_output .= "\t</PhoneNums>\n";
- $xml_output .= "\t</Personel>\n";
- $xml_output .= "\t</PhoneBook>\n";
- }
- $xml_output .= "</Screen>";
- echo $xml_output;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement