This article describes how to use php to list all rows and columns in a mysql table. it involves the skills of using php to operate a mysql database and has some reference value, for more information about how to use php to list all rows and columns in a mysql table, see the following example. Share it with you for your reference. The specific implementation method is as follows:
The code is as follows:
Selecting Data
<? Php
$ User = "root ";
$ Pass = "";
$ Db = "mydatabase ";
$ Link = mysql_connect ("localhost", $ user, $ pass );
If (! $ Link ){
Die ("Couldn't connect to MySQL:". mysql_error ());
} Mysql_select_db ($ db, $ link) or die ("Couldn't open $ db :". mysql_error (); $ result = mysql_query ("SELECT * FROM domains where sex = 'F '");
$ Num_rows = mysql_num_rows ($ result); print"
$ Num_rows women have added data to the table
\ N "; print"
";While ($ a_row = mysql_fetch_row ($ result )){Print"
";Foreach ($ a_row as $ field ){Print"
". Stripslashes ($ field )." | ";}Print"
";}Print"
";
Mysql_close ($ link );
?>
I hope this article will help you with php programming.