【发布时间】:2014-01-02 21:15:17
【问题描述】:
如何在搜索后返回我的数组的索引值。
$sql=mysql_query("SELECT id,userName,email FROM user ORDER BY id ASC");
$myArray=array();
while($row=mysql_fetch_array($sql)){
$myArray[$row['eMail']]=$row;
}
我收到电子邮件作为 GET 变量,我需要这样搜索
$search = $_GET["eMail"];
if (isset($myArray[$search])) {
echo $my_values[$search];
$isEmailStored= 1; // **means that I have but in WHICH INDEX I need to find out that**
}
else {
$isEmailStored=0;
}
【问题讨论】:
标签: php mysql sql arrays search