문제

I have succesfully been able to move an array of 72 values to new sheet:(whith much help from you all and a little luck on my part) verified by the print_r

howvever, I am getting "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in .../admin/emailall.php on line 14

The query is valid when I enter in a number

<?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>";
?>

the table is tempory and and simpy a check

도움이 되었습니까?

해결책

Bill

$_POST is an array in the form $_POST['fieldname1'], $_POST['fieldname2'].

Doing implode(',',$_POST); wont work it need a field name like implode(',',$_POST['fieldname1']);

다른 팁

The IN keywords needs a list of the form (firstVal, secondVal,...). So,

"SELECT sp.email_address AS email FROM stats_player sp
WHERE sp.player_num IN ($Pnum)"

should work assuming $Pnum contains numbers only (strings would have to be surrounded by 's)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top