简体   繁体   English

php从所有行的同一列中获取特定数据

[英]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.

相关问题 PHP:MY​​SQLI-从同一行获取数据 - PHP: MYSQLI - Get data from same row PHP,HTML和MySqli-如何在一个表行中显示特定列的所有数据 - PHP, HTML and MySqli - how to show all data from specific column in one table row 如何从表中获取所有数据,如果在同一列中重复相同的值,则该行应计数一次? - How to get get all the data from table and if same value repeated in one column that row should count once? PHP - 从同一行的不同列中获取和比较行值 - PHP - Get and compare row value from a different column for the same row 如何仅在PHP中获取第一行的特定列数据SQL? - How to get specific column data SQL for first row only in PHP? 如何在PHP Codeigniter中从一个表中获取特定列,并从另一表中获取所有其他数据 - How to get specific column from one table and all other data from other table in php codeigniter 从数据库中检索特定行,并显示特定行中的所有数据,然后使用php发送json - Retrieve specific row from database and display all the data in the specific row and send json using php 在特定表列上显示PHP在MySQL上的行内容(不同表上的.row名称相同) - Show MySQL row content on PHP from specific table column (same .row name on different tables) PHP / MYSQL使用while循环获取当前行,然后从第1列输出数据,然后对以下行进行相同的操作 - PHP/MYSQL using while loop to get current row then output data from column 1, then proceed to do the same for the following rows Laravel:如何在另一个表的所有行中以数组格式获取M:M关系的特定列数据 - Laravel: How to get specific column data of M:M relationship in array format in all row of a another table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM