@@@@@@@@@@@@@@@@@ connection @@@@@@@@@@@@@@@ <?php $servername= "localhost"; $username="root"; $password="";$dbname="test"; $conn= new mysqli($servername,$username,$password,$dbname); if($conn->connect_error){ die("connection failed:" .$conn->connect_error); } @@@@@@@@@@ Fetch data @@@@@@@@@@@@@ $sql = "SELECT *FROM contacts"; $result= $conn->query($sql); if($result->num_rows >0){ while($row= $result->fetch_assoc()){ // echo '<pre>'; // echo "contacts_id:{$row["contacts_id"]} -Name:{$row["contacts_name"]} -Email:{$row["contacts_email"]} -Message{$row["contacts_message"]} \n"; // echo '</pre>'; echo '<ul>'; echo "<li> contacts_id:{$row["contacts_id"]}</li> <li>-Name:{$row["contacts_name"]}</li><li> -Email:{$row["contacts_email"]}</li> <li>-Message{$row["contacts_message"]}</li> \n"; echo '</ul>'; } }else{ echo "No results Found"; } <?php @@@@@@@@@@@@@@ SHOW IN TABLE @@@@@@@@@@@@@@@@@ $sql = "SELECT *FROM contacts"; $result= $conn->query($sql);?> <table border="1" cellspacing="2" cellpadding="3" width="100%"> <thead> <tr> <th> Id:</th> <th>Name: </th> <th> Email:</th> <th>Message:</th></tr> </thead> <tbody> <?php if($result->num_rows >0){ while($row= $result->fetch_assoc()){ echo "<tr style='text-align:center'> <td align:center>{$row["contacts_id"]} </td> <td style='text-align:center' >{$row["contacts_name"]}</td> <td>{$row["contacts_email"]}</td> <td>{$row["contacts_message"]}</td> </tr>"; } }else{ echo "No results Found"; } $conn->close(); ?> </tbody></table>
September-04-2024 09:18:37
August-11-2024 11:31:12
August-02-2024 23:22:25
May-12-2024 02:44:34
May-10-2024 20:14:30