我已经成功地将72个值的数组移动到新的表格中:(由你们提供了很多帮助,而且我有点运气)经print_r
验证了
然后,我收到“警告:mysql_fetch_array():提供的参数不是第14行的... / admin / emailall.php中的有效MySQL结果资源
当我输入数字时,查询有效
<?php
include "inc.php";
//print_r ($_POST);
$Pnum=implode(',',$_POST);
$querymail=mysql_query("select sp.email_address as email from stats_player sp
where sp.player_num IN $Pnum");
//have tried ($Pnum) '$Pnum' (".'$Pnum'.") and I think a few other cominations
echo "<table>";
while($row=mysql_fetch_array($querymail))
{
echo "<tr><td>".$row['email']."</td></tr>";
}
echo"</table>";
?>
这张桌子是临时的,而且简单的检查
答案 0 :(得分:1)
IN
个关键字需要一个(firstVal, secondVal,...)
形式的列表。所以,
"SELECT sp.email_address AS email FROM stats_player sp
WHERE sp.player_num IN ($Pnum)"
应该可以正常工作,假设$ Pnum只包含数字(字符串必须被'
包围)
答案 1 :(得分:1)
比尔
$ _ POST是$ _POST ['fieldname1'],$ _POST ['fieldname2']形式的数组。
执行implode(',',$_POST);
无法正常工作需要implode(',',$_POST['fieldname1']);