This tutorial is helpful for beginners. We talk about database connection and use the mysql tutorial _ query, mysql_num_rows, and mysql_fetch_row functions to read and output records.
<Html>
<Head>
<Title> Selecting Data </title>
</Head>
<Body>
<? Php tutorial
$ 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 "<p> $ num_rows www.zhutiai.com women have added data to the table </p> n ";
Print "<table> ";
While ($ a_row = mysql_fetch_row ($ result )){
Print "<tr> ";
Foreach ($ a_row as $ field ){
Print "<td>". strips tutorial lashes ($ field). "</td> ";
}
Print "</tr> ";
}
Print "</table> ";
Mysql_close ($ link );
?>
</Body>
</Html>