Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $html = file_get_html('http://itecdigital.org.uk/2015/430926/BeautyFactoryBooking/admin.php');
- $dom = new DOMDocument();
- $dom->loadHTML($html);
- $elements = $dom->getElementsByTagName('tr');
- //Loop through each row
- foreach ($rows as $row) {
- //Loop through each child (cell) of the row
- foreach ($row->children() as $cell) {
- echo $cell->plaintext; // Display the contents of each cell - this is the value you want to extract
- }
- }
- ?>
- <?php
- echo "<table style='border: solid 1px black;'>";
- echo "<tr><th>Id</th><th>First Name</th><th>Last Name</th><th>Email Address</th><th>Phone Num</th><th>Treatment</th><th>Date</th><th>Time</th><th>Message</th><th>Reply</th></tr>";
- class TableRows extends RecursiveIteratorIterator {
- function __construct($it) {
- parent::__construct($it, self::LEAVES_ONLY);
- }
- function current() {
- return "<td style='width:100px;border:1px solid black;'>" . parent::current(). "</td>";
- }
- function beginChildren() {
- echo "<tr>";
- }
- function endChildren() {
- echo "</tr>" . "n";
- }
- }
- $servername = "#";
- $username = "#";
- $password = "#";
- $dbname = "#";
- try {
- $conn = new PDO("mysql: host=$servername; dbname=$dbname", $username, $password);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $stmt = $conn->prepare("SELECT Booking_request_form.id_booking, Client_Information.first_name, Client_Information.last_name, Client_Information.email_address, Client_Information.phone_number, Booking_request_form.treatment, Booking_request_form.date, Booking_request_form.time, Booking_request_form.message FROM Booking_request_form INNER JOIN Client_Information WHERE Client_Information.id_client=Booking_request_form.client_fk");
- $stmt->execute();
- // set the resulting array to associative
- $result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
- foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) {
- echo $v;
- }
- }
- catch(PDOException $e) {
- echo "Error: " . $e->getMessage();
- }
- $conn = null;
- echo "</table>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement