PHP The complete code for querying the MySQL database. Please pay attention to modifying the username and password in the connection statement when using it.
$link = mysql_connect('localhost', 'root', '123456') //Rainfire Tip: Please change the 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 the result in HTML
echo "
n";
while ($line = mysql_fetch_assoc($result)) {
echo "tn";
foreach ($line as $col_value) {
echo "tt$col_value< ;/td>n"; } echo "t |
n";
}
echo "
n";
// Release the result set
mysql_free_result($result);
// Close the connection Liehuo.Org
mysql_close($link);
?>
http://www.bkjia.com/PHPjc/364555.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364555.htmlTechArticlePHP The complete code for querying the MySQL database. Please pay attention to modifying the user name and password in the connection statement when using it. ?php $link = mysql_connect('localhost', 'root', '123456') //Fire Tip: Please...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn