Reputation: 453
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
Upvotes: 0
Views: 43
Reputation: 94662
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']);
Upvotes: 1
Reputation: 1385
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)
Upvotes: 1