Home>Article>Backend Development> Implementation method of php mysql query display

Implementation method of php mysql query display

藏色散人
藏色散人 Original
2020-08-08 10:39:03 3369browse

php Mysql query display implementation method: first define a "ShowTable" method; then connect to the database through "mysql_connect"; then use "mysql_query" and other functions to query the database; finally, display and output the query results in a table .

Implementation method of php mysql query display

Recommended: "PHP Video Tutorial"

PHP queries the MySql database and outputs the results in a table Example

When using PHP to develop a website, MySql database query results are output in tables, which may be difficult for students who are new to PHP program development.

This article uses an example to demonstrate the function of PHP querying the MySql database and outputting the results in a table. I hope it will be helpful to everyone's PHP programming.

 "; echo "共计".$rows."行 ".$colums."列
"; echo ""; for($i=0; $i < $colums; $i++){ $field_name=mysql_field_name($res,$i); echo ""; } echo ""; while($row=mysql_fetch_row($res)){ echo ""; for($i=0; $i<$colums; $i++){ echo ""; } echo ""; } echo "
$field_name
$row[$i]
"; } ShowTable("test1"); ?>

The above is the detailed content of Implementation method of php mysql query display. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use php call method Next article:How to use php call method