Jump to content

Recommended Posts

i have an online mysql database that contains a field to store links in it, every row have a unique link to a file

when the user search for the files i want to put a button in the result table that let the user press on it to download the file from the link of that file

any help?

This forum loves to help those who help themselves. With that point clear - until you show an ability to write SOME code, people here usually will not give you code help. If you can't code already then it really doesn't help you for us to give you one line of it.

 

A point to consider is that the button would submit a form to your script that then grabs the input elements hidden in your page's form. If you have multiple sets of info on your webpage, you may have multiple forms embedded in, each one with a button that submits its own form, passing the data needed to the download script.

 

If that makes sense, happy coding!

Since you already have a mysql database I would assume you know how to connect to that database and perform a select query.

If not here is 2 links that can help you.

http://php.net/manual/en/mysqli.query.php

http://php.net/manual/en/pdo.query.php

 

Once you have a loop of results you can echo the row value within an <a> tag and use the download attribute

echo "<a href='".$row['link']."' download='".$row['link']."'>".$row['link']."</a><br />";
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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