我使用以下代码:
$con = mysql_connect("NOTGIVEN","NOTGIVEN","NOTGIVEN");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("user_live", $con);
$result = mysql_query("SELECT * FROM user_new_post ORDER BY user_date_post DESC");
while($row = mysql_fetch_array($result))
{
print($row['user_full_name']);
}
除了选择表/行user_new_post
,我怎样才能选择单个值“user”,然后打印/回显它们?
最佳答案
您有另一个可以使用的表“用户”
SELECT * FROM user
或者您可以使用 WHERE 子句
SELECT * FROM user_new_post WHERE user_full_name like 'a%' ORDER BY user_date_post DESC
获取所有以“a”开头的用户全名
关于php - 如何从mysql中的列/表中选择多行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5587570/