Home  >  Article  >  php教程  >  php+mysql调用数据库示例

php+mysql调用数据库示例

WBOY
WBOYOriginal
2016-06-21 09:05:351409browse

mysql|示例|数据|数据库

$conn= mysql_connect('localhost','root','123456') or die('connect error:'.mysql_error());
mysql_select_db('netDuzhe');
$result=Mysql_query('select * from article');
    while ($row = mysql_Fetch_array($result, MYSQL_BOTH)) {
        printf ("ID: %s  Name: %s content:%s", $row[0], $row[1],$row[2]);
    }

    mysql_free_Result($Result);
?>

注意点



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