[英]php get specific data from the same column in all row
i have a php question, how can i get all the data from the same column from all row in a mysql table. 我有一个PHP问题,如何从mysql表的所有行的同一列中获取所有数据。
Table name : user 表名:用户
Here's my table structure: 这是我的表结构:
name 名称
url 网址
How can i use php to get all the data in URL column from each row? 我如何使用php从每一行获取URL列中的所有数据? (P/S i have my connection to database established , just not sure the musql query for this)
(P / S我已建立与数据库的连接,只是不确定对此的musql查询)
Thanks and have a nice day. 感谢,并有一个愉快的一天。
This really is extremely basic stuff and you could have found this anywhere, it's even in the PHP manual. 这确实是非常基础的东西,您甚至可以在PHP手册中的任何地方找到它。 But alas, here you go.
但是,a,您来了。
$result = mysql_query("SELECT url FROM user");
while($row=mysql_fetch_assoc($result){
echo $row['url'].'\n';
}
Please read up on some basic stuff to avoid asking these kind of questions: http://www.freewebmasterhelp.com/tutorials/phpmysql 请仔细阅读一些基本知识,以避免提出此类问题: http : //www.freewebmasterhelp.com/tutorials/phpmysql
$query = "select url from user";
$result = mysql_query($query);
while( $row = mysql_fetch_assoc($result)){
echo $row['url'] . '<br>';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.