Jump to content

smilla

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by smilla

  1. What can I say, that's perfect. Thanks for all your help - I just couldn't work out the logic myself.
  2. 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?
  3. ok, thanks guys this bit is fine. does anyone know how I loop through the query to write the data to an excel spreadsheet?
  4. Thanks, that figures. I actually want to select more data from the database based on the $id values. What would be the best way to write the data retrieved to excel?
  5. Thanks for your reply, still a little confused though, This is retrieving the data from web page but how do I retrieve the data from the database with this?
  6. Hi everyone, This is my first comment on PHPFreaks so be gentle...... I am relatively new to PHP, I have an asp.net background but here is my problem... I have a webpage with rows of data from a mysql database. I have added a checkbox by each row (which is identified by $id) <input type='checkbox' name='row[]' value='".$data['id']."'> The user checks multiple checkboxes for export. this is where I get stuck. I know that I need to create a dump of the selected rows from database where id = $id, put this into another array and then write this array to an excel file. I have spent many an hour researching this, but it seems that there is nothing (that I can find) which helps with the selection of the checkboxes first. I would appreciate any help on this. Regards Samidoo
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.