[英]Fetching array from MySQL database
I am trying to make a page for re-sending the activation mail to the a members of my site who have not received it. 我正在尝试制作一个页面,用于将激活邮件重新发送给尚未收到激活邮件的站点的成员。 I'm not able to fetch the required data from
mysql
. 我无法从
mysql
获取所需的数据。 This is what I have tried - 这是我尝试过的-
$act = mysql_query("SELECT activate FROM users WHERE email='$mail'");
where users
is the table name, activate
is the column name from which data is to be fetched. 其中
users
是表名, activate
是要从中获取数据的列名。 The email address of which the code is to be fetched is stored in $mail
and email
is a column name in the table. 要获取其代码的电子邮件地址存储在
$mail
而email
是表中的列名称。
I want to fetch the data from the column activate
and row which is same as the row in which the value of email
column is same as the value in $email
. 我想从
activate
和row列中获取数据,该列与其中email
列的值与$email
的值相同的行相同。
This is the output I am currently getting - Resource id #11
这是我当前得到的输出-
Resource id #11
While the correct output must be something like - 55445513
虽然正确的输出必须类似于
55445513
Any help would be greatly appreciated :) 任何帮助将不胜感激 :)
Use this: 用这个:
$act = mysql_query("SELECT activate FROM users WHERE email='$mail'");
$act_array = mysql_fetch_array($act);
You can then reference $act_array for your array element results. 然后,您可以为数组元素结果引用$ act_array。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.