Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $database = "dummyServer";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password,$database);
- // Check connection
- if (!$conn)
- {
- die("Connection failed: " . mysqli_connect_error());
- }
- //echo "Connected successfully ";
- if ($_SERVER["REQUEST_METHOD"] == "POST")
- {
- $id = urldecode($_POST['Id']);
- //$id=1;
- $sql = "SELECT feedback from INFORMATION WHERE id = ".$id;
- //echo $sql;
- $result = mysqli_query($conn, $sql);
- $xml=<<<XML
- <Information></Information>
- XML;
- $xml=simplexml_load_string($xml);
- if (mysqli_num_rows($result) > 0)
- {
- $i=0;
- // output data of each row
- while($row = mysqli_fetch_assoc($result))
- {
- $xml->addChild("Feedbacks");
- $xml->Feedbacks[$i]->addChild("feedback",$row["feedback"]);
- $i=$i+1;
- }
- }
- $dom = new DOMDocument("1.0");
- $dom->preserveWhiteSpace = false;
- $dom->formatOutput = true;
- $dom->loadXML($xml->asXML());
- echo "<pre>".htmlentities($dom->saveXML())."</pre>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement