来自W3Schools的示例:PHP从MySQL选择数据
<?php$con=mysqli_connect("example.com","peter","abc123","my_db");// Check connectionif (mysqli_connect_errno()){echo "Failed to connect to MySQL: " . mysqli_connect_error();}$result = mysqli_query($con,"SELECt * FROM Persons");echo "<table border='1'><tr><th>Firstname</th><th>Lastname</th></tr>";while($row = mysqli_fetch_array($result)){echo "<tr>";echo "<td>" . $row['FirstName'] . "</td>";echo "<td>" . $row['LastName'] . "</td>";echo "</tr>";}echo "</table>";mysqli_close($con);?>这是一个学习的好地方!



