且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 MySQL 获取多行输出

更新时间:2023-12-04 11:48:22

使用循环:

$res = mysql_query("select * from tableA");
while ($row = mysql_fetch_array($res)) {
    echo $row['msg'];
}

请不要在新代码中使用mysql_*函数一>.它们不再维护并正式弃用.看到红框?了解准备好的语句,并使用PDOMySQLi> - 这篇文章 将帮助您决定哪个.如果您选择 PDO,这里有一个很好的教程.

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO, or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.