如何获取Mysql字段数据[关闭]

I have a registration system , username, password, email id are stored in a table, how can i export or get all email ids of all my registered users in Phpmyadmin itself (or any other way).

Run query

select email_id from users 

Then use export feature of phpmyadmin.After you run the query, click the export link and you can export the query result in many different formats (e.g CSV, Excel, Word...)

Please change table and column names according to you.

try this>>

$sql = "select email_id from table_name";
$result = mysql_query($sql);

$email_collector = array();

while( $row = mysql_fetch_assoc($result) ){
  //store email in array
  $email_collector[] = $row['email_id'];
}

print_r($email_collector);

Change email_id and table_name according to your database

If you want to get list of users and their email in a text file try the below query

SELECT username, email INTO OUTFILE 'data.txt'
  FIELDS TERMINATED BY ','
  LINES TERMINATED BY '
' 
  FROM table2;