Jump to content

Download file from Mysql


RidgeandGable

Recommended Posts

  • Replies 57
  • Created
  • Last Reply

cheers got it working 

<table border="3">
         <tr>
           <td>id</td>
           <td>username</td>
           <td>datebooked</td>
           <td>timebooked</td>
           <td>notes</td>
         </tr>
         <?php do { ?>
           <tr>
             <td><?php echo $row['id']; ?></td>
             <td><?php echo $row['username']; ?></td>
             <td><?php echo $row['datebooked']; ?></td>
             <td><?php echo $row['timebooked']; ?></td>
             <td><?php echo $row['notes']; ?></td>
           </tr>
           <?php } while ($row = mysql_fetch_assoc($Recordset1)); ?>
</table>

Just looking how to add colour change :) Slowly winning

lol I figure it out. My head is banging, but big improvements on site now tho http://scotair.noip.me I have left the test username on so User - alex & password alex :D

 

I did want to ask one quick question but feel free to tell me where to go lol

Would this code take much to alter and instead of going to download, display the files by a centre size on page? Reason I ask is because that little bit of code you done works so well, it would also make an ideal little pic gallery allowing me to upload etc by username?

 

echo '<h2>Customer Invoices</h2>';

// get the files belonging to the logged in user
$result = mysql_query('SELECT upid, name, size FROM upload WHERE username=\''.mysql_real_escape_string($_SESSION['MM_Username']).'\'');

// check query did execute without errors
if($result)
{
    // output each file
    while($row = mysql_fetch_assoc($result))
    {
       echo '<a href="download1.php?upid='.$row['upid'].'">'.$row['name'].'</a><br />';
    }
// query did not execute, log or show error message
} else {
    trigger_error('Cannot get users files from database: ' . mysql_error());
}
?>

instead of tbl upload it would be table gallery?

No. Don't. Just google - php gallery tutorial, find some decent one and pick it up. I am not trolling or being glib, but you are not a guy who is trying to learn into the good programming habits :happy-04:

 

BTW: thanks for the beer mate :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.