[ Prev ]
2021-03-22

-- Practice Midterm Problems Thread
Group 5: Dat Ng, Nhieu Lam, Aung Lin
5. Explain with example code and drawing of how it would be rendered, the following css property values: (a) display:inline-block, (b) position: fixed, (c) p:hover { visibility:hidden}.
(a) display:inline-block will add some the top and bottom margins to the selected element.
No inline-block Resource Description for no-inlineBlock.png
With inline-block Resource Description for inlineBlock.png
(b) position: fixed will fix the position of the selected element in the same place even if the page is scrolled.
No fixed position Resource Description for no-fixPosition.png
With fixed position Resource Description for fixedPosition.png
(c) p:hover { visibility:hidden} will hide the selected element when we hover the mouse over it.
No hover Resource Description for inlineBlock.png
With hover Resource Description for hover.png
(Edited: 2021-03-22)
Group 5: Dat Ng, Nhieu Lam, Aung Lin 5. Explain with example code and drawing of how it would be rendered, the following css property values: (a) display:inline-block, (b) position: fixed, (c) p:hover { visibility:hidden}. (a) display:inline-block will add some the top and bottom margins to the selected element. No inline-block ((resource:no-inlineBlock.png|Resource Description for no-inlineBlock.png)) With inline-block ((resource:inlineBlock.png|Resource Description for inlineBlock.png)) (b) position: fixed will fix the position of the selected element in the same place even if the page is scrolled. No fixed position ((resource:no-fixPosition.png|Resource Description for no-fixPosition.png)) With fixed position ((resource:fixedPosition.png|Resource Description for fixedPosition.png)) (c) p:hover { visibility:hidden} will hide the selected element when we hover the mouse over it. No hover ((resource:inlineBlock.png|Resource Description for inlineBlock.png)) With hover ((resource:hover.png|Resource Description for hover.png))

-- Practice Midterm Problems Thread
GROUP 10: Tai Huynh, Rebecca Salas, Khoa Tran
Question 10: Write a PHP class with method drawFooTable which makes a connection to a Mysql database Goo running on localhost on the default port. It then retrieves all rows and columns from the Foo table and prints then to an XHTML page.
<?php
class MyClass {
   function drawFooTable() {
        $data = [];
        
        $mysqli = new mysqli("localhost", "my_user", "my_password", "Goo");
        $result = $mysqli->query("SELECT * FROM Foo");
         
        if ($result->num_rows > 0) {
        // output data of each row
            while($row = $result->fetch_array()) {
                $data[] = $row;
            }
        }
        $mysqli->close();
        echo "<table>";
        foreach($data as $key => $value) {
            echo "<tr>";
            for ($i = 0; $i < count($value); $i++) {
                echo "<td>".$value[$i]."</td>";
            }
            echo "</tr>";
        }
        echo "</table>";
}
$my_class = new MyClass();
$my_class->drawFooTable();
(Edited: 2021-03-22)
GROUP 10: Tai Huynh, Rebecca Salas, Khoa Tran Question 10: Write a PHP class with method drawFooTable which makes a connection to a Mysql database Goo running on localhost on the default port. It then retrieves all rows and columns from the Foo table and prints then to an XHTML page. <?php class MyClass { function drawFooTable() { $data = []; $mysqli = new mysqli("localhost", "my_user", "my_password", "Goo"); $result = $mysqli->query("SELECT * FROM Foo"); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_array()) { $data[] = $row; } } $mysqli->close(); echo "<table>"; foreach($data as $key => $value) { echo "<tr>"; for ($i = 0; $i < count($value); $i++) { echo "<td>".$value[$i]."</td>"; } echo "</tr>"; } echo "</table>"; } $my_class = new MyClass(); $my_class->drawFooTable();
X