PHP Query the full code of MySQL database
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/848319.html www.bkjia.com true http://www.bkjia.com/PHPjc/848319.html techarticle PHP query MySQL database complete code PHP query MySQL database complete code, when used, please be careful to modify the connection statement in the user name and password. php $link = mysql_connect (' Localho ...