The example in this article tells you how PHP lists all the rows and columns in the MySQL table. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
<title>selecting data</title>
<body>
<?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 domain s where sex= ' F ' ");
$num _rows = mysql_num_rows ($result);p rint "<p> $num _rows women have added data to the table</p>\n";p rint " ;table> ";
while ($a _row = Mysql_fetch_row ($result)) {
print "<tr>";
foreach ($a _row as $field) {
Print "<td>". Stripslashes ($field). </td> ";
}
print "</tr>";
}
print "</table>";
Mysql_close ($link);
?>
</body>
I hope this article will help you with your PHP program design.