Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

add to database when user downloads a file

Codes here !

Moderators: macek, egami, gesf

add to database when user downloads a file

Postby enigma » Thu Mar 22, 2012 2:58 pm

I would like to be able to add a yes/no to a field in a 'user' database when a logged in user clicks on a link to download a file.
The site I have built stores docs and applications. and my client would like to know which user has downloaded a certain application (clicked on a button to 'download' and installer file.
Is this possible?
enigma
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Mar 22, 2012 2:52 pm

Re: add to database when user downloads a file

Postby freshnet » Thu Mar 22, 2012 3:43 pm

definitely. I'd do it using a form, then you can use
Code: Select all
isset($_POST['submit'])
to test whether the form has been submitted. You can then use if to run the query.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: add to database when user downloads a file

Postby enigma » Thu Mar 22, 2012 4:17 pm

I am a newbie, so don't have a clue where to start with coding...

Any help greatly appreciated.
enigma
New php-forum User
New php-forum User
 
Posts: 2
Joined: Thu Mar 22, 2012 2:52 pm

Re: add to database when user downloads a file

Postby freshnet » Thu Mar 22, 2012 4:36 pm

Do you have your database created or a basic knowledge of PHP/SQL?
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: add to database when user downloads a file

Postby danceinsky » Mon Jul 30, 2012 7:24 pm

basic knowledge of PHP/SQL?



Rc Helicopters Reviews|Rc Helicopter
danceinsky
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Jul 30, 2012 7:11 pm

Re: add to database when user downloads a file

Postby NigelRen » Thu Aug 02, 2012 11:28 pm

It would be worth creating a new database table which has the user and the file identifiers on it. Then when a user has downloaded a file you can insert a record into this table which indicates which user has downloaded which files. You could include a date as well so that you can see when they have downloaded it.
Have a go at creating the table and writing some code, if you still have problems then post your code and I'm sure someone will help.
NigelRen
php-forum Active User
php-forum Active User
 
Posts: 450
Joined: Fri Aug 05, 2011 9:53 am


Return to mySQL & php coding

Who is online

Users browsing this forum: rtlm1234 and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.