How to get the database content with php?
For example, there are three tables named 1.2.3 in HTML, and the database has three corresponding colors. How to make the background color of each table obtain the value from the database and display it.
Processing code such as:
query("SELECT * FROM color where id='" . $id . "'")) { $row = $result->fetch_assoc(); return $row['color']; } return '#000000'; } $mysqli = new mysqli("localhost", "test", "test", "room"); if ($mysqli->connect_error) { printf("数据库连接错误: %s\n", mysqli_connect_error()); exit(); } ?>
1 |
2 |
3 |
For more PHP related knowledge, please visitPHP Chinese website!
The above is the detailed content of How to get database content in php. For more information, please follow other related articles on the PHP Chinese website!