Thanks saviola, I tried that bit of code but could not get it to work.
ok this is what I have so far:-
foreach ($_POST['row'] as $k=> $c)
{
$sql = mysql_query("SELECT comments.nominee as Nominee, company.company as Company, comments.department as Department FROM comments INNER JOIN company ON comments.cid=company.id WHERE comments.id = '$c'") or die('Query failed!');
$newcount = 0;
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res)){
if ($newcount == 0){
$out = implode("\",\"",array_keys($row))."\n";
$newcount++;}
$out .= implode("\",\"",$row)."\n";
}
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"my-data.csv\"");
echo $out;
}
Here is the output:-
<br />
<b>Warning</b>: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
<b>Notice</b>: Undefined variable: out
<b>Warning</b>: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
<b>Notice</b>: Undefined variable: out
<b>Warning</b>: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
<b>Notice</b>: Undefined variable: out
This is because I check boxed 3 records?