| | |
Uploading to specific field in datatbase
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2009
Posts: 25
Reputation:
Solved Threads: 0
Heres one for ya...
Lets say you have a mysql database with multiple entries (clients). Each one has a field for name, username ect. There is also one for say storing a doc file for billing. How can I make it so I can upload a file to just a specific clients "billing" field in the database?
Oooooooor, do I store these files on the server? Which would bring me to the question of how to upload the files to a specific directory though a web browser.
I am trying to figure out the best way to create an "Admin control panel" to be able to update the clients without having to use an ftp program.
Mabey thats just the best way. I am looking for suggestions and code. Im still pretty new at this.
I also have a post looking for ways to display these files for the clients on thier login page. I used the echo statment and only got a coded version of the file.
Lets say you have a mysql database with multiple entries (clients). Each one has a field for name, username ect. There is also one for say storing a doc file for billing. How can I make it so I can upload a file to just a specific clients "billing" field in the database?
Oooooooor, do I store these files on the server? Which would bring me to the question of how to upload the files to a specific directory though a web browser.
I am trying to figure out the best way to create an "Admin control panel" to be able to update the clients without having to use an ftp program.
Mabey thats just the best way. I am looking for suggestions and code. Im still pretty new at this.
I also have a post looking for ways to display these files for the clients on thier login page. I used the echo statment and only got a coded version of the file.
-1
#2 Nov 5th, 2009
You could save all the info in a blob field (no physical file - just some encoded info in a field, which can produce a file on demand), OR just store an url/path for a physical file stored in a certain folder.
E.g.
users table
id (PK)
username
... etc ...
billing table
id (PK)
user_id (Foreign Key on id in users)
dated (billing date)
amount (Billing Amount)
reconciled (Y/N)
invoice_file ***(this is where you store the file's path)
...other fields...
You shoud be able to store a pdf file of the invoice, otherwise you could produce it dynamically from billing info - you can use something like fpdf for either approach
E.g.
users table
id (PK)
username
... etc ...
billing table
id (PK)
user_id (Foreign Key on id in users)
dated (billing date)
amount (Billing Amount)
reconciled (Y/N)
invoice_file ***(this is where you store the file's path)
...other fields...
You shoud be able to store a pdf file of the invoice, otherwise you could produce it dynamically from billing info - you can use something like fpdf for either approach
If you don't reply to your own thread or you can't find the solved link - you're off my Christmas list - permanently! Bah humbug!
0
#4 Nov 9th, 2009
Hey.
I wrote an article that explains in detail how you would upload a file into a MySQL database. (Linkage).
In case you choose to go that route.
I wrote an article that explains in detail how you would upload a file into a MySQL database. (Linkage).
In case you choose to go that route.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
0
#6 Nov 10th, 2009
•
•
•
•
Ok, now, how can I password protect the directory that holds the file so its not accessable by others, but is to the logged in user?
There are also ways to use .htaccess files (Apache only) to restrict access to specific directories, but that won't integrate with PHP as easily.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
And use [code] tags!
![]() |
Similar Threads
- Accessing a field in SQL (MS SQL)
- Show price in field when radio button or checkbox is selected. (JavaScript / DHTML / AJAX)
- Extracting values from the specific field (MS SQL)
- Update specific field in MySQL (PHP)
- Order by random - within a field? (MS SQL)
- need a tutorial on how to setup a forum (PHP)
- Mysql match and return words in field w/ all rows (MySQL)
- need an idea to program (Computer Science)
Other Threads in the PHP Forum
- Previous Thread: monitor size
- Next Thread: Cron Jobs
Views: 279 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class clean cms code crack cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail match menu methods mlm mod_rewrite multiple mysql oop pageing parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space spam speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube






