elexion Posted January 21, 2010 Author Share Posted January 21, 2010 ok so for reading out the files that are inserted into the database i've now written this script: <?php$query ="SELECT * FROM subpage WHERE subpages='logbook' ORDER BY ID DESC";$fout_query ="houston we have a problem with our query over";$result=mysql_query($query,$db) or die($fout_query);echo "<table border='1'> <th>id</th> <th>mesages</th> <th>yyyy-mm-dd <th>files</th>";for ( $i=0; $i<mysql_num_rows($result); $i++){$data=mysql_fetch_array($result);echo "<tr> <td>".$data["id"]."</td> <td>".$data["messages"]."</td> <td>".$data["date"]."</td> <td>".$data["file"]."</td> <td> <a href='fileDownload.php?id={$query['id']}\">Download</a> </td> </tr>";}echo "</table>";?> now what is the next step i should take, i've found this old script but not sure if it's useful and how to make it work; <?phpif ($query['id']) { include "connect.php"; $sql = "SELECT bin_data, filetype, filename, filesize FROM subpages WHERE id_files=$id_files"; $result = @mysql_query($sql, $db); $data = @mysql_result($result, 0, "bin_data"); $name = @mysql_result($result, 0, "filename"); $size = @mysql_result($result, 0, "filesize"); $type = @mysql_result($result, 0, "filetype"); header("Content-type: $type"); header("Content-length: $size"); header("Content-Disposition: attachment; filename=$name"); header("Content-Description: PHP Generated Data"); echo $data;}?> Link to comment Share on other sites More sharing options...
elexion Posted January 25, 2010 Author Share Posted January 25, 2010 <?php$query ="SELECT * FROM subpage WHERE subpages='logbook' ORDER BY ID DESC";$fout_query ="houston we have a problem with our query over";$result=mysql_query($query,$db) or die($fout_query);echo "<table border='1'> <th>id</th> <th>mesages</th> <th>yyyy-mm-dd <th>files</th>";for ( $i=0; $i<mysql_num_rows($result); $i++){$data=mysql_fetch_array($result);echo "<tr> <td>".$data["id"]."</td> <td>".$data["messages"]."</td> <td>".$data["date"]."</td> <td>".$data["file"]."</td> <td> <a href='fileDownload.php?id={$query['id']}\">Download</a> </td> </tr>";}echo "</table>";?> reach the "fileDownload.php" page and boom undefined variable error ;\ shouldnt the $query['id'] still work on the next page? Link to comment Share on other sites More sharing options...
Synook Posted January 25, 2010 Share Posted January 25, 2010 It would now be in the $_GET superglobal array, as you are passing it using GET. Link to comment Share on other sites More sharing options...
elexion Posted January 25, 2010 Author Share Posted January 25, 2010 It would now be in the $_GET superglobal array, as you are passing it using GET./facepalm i can't believe i didnt think of that haha thanks Synook. Worst part i was justreading up on the GET function haha. Oh mondays how i hate them Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.