PHP Query the full code of the MySQL database, when used, please be careful to modify the connection statement in the user name and password.
$link = mysql_connect (' localhost ', ' root ', ' 123456 ')//Fire tips: Please change your username and password first
Or Die (' Could not connect: '. Mysql_error ());
mysql_select_db (' Ruida ') or Die (' Could not select database ');
Execute SQL Query
$query = ' SELECT * from product ';
$result = mysql_query ($query) or Die (' Query failed: '. mysql_error ());
Display results in HTML
echo "
\ n "; while ($line = Mysql_fetch_assoc ($result)) {echo \ t
\ n "; foreach ($line as $col _value) {echo "\t\t
| $col _value | \ n "; } echo "\ t
\ n "; } echo "
\ n ";
Releasing the result set
Mysql_free_result ($result);
Close Connection liehuo.org
Mysql_close ($link);
?>
http://www.bkjia.com/PHPjc/364555.html www.bkjia.com true http://www.bkjia.com/PHPjc/364555.html techarticle PHP Query The complete code of the MySQL database, when used, please be careful to modify the user name and password in the connection statement. PHP $link = mysql_connect (' localhost ', ' root ', ' 123456 ')//Fire tips: please ...