Click to See Complete Forum and Search --> : Basic Online Database question
miggetyMike
06-10-2005, 06:40 PM
Hello all,
I was asked to create an online database to store files which are organized by a few characteristics. People with authorization should be able to add files associated with specific information as well as query and download files according to specific characteristics.
I am fairly new to web design but have a working PHP based page up. I have not worked with databases before and would like to know how I might go about learning the techniques to accomplish the above tasks.
I am no newbie to programming in general, just need direction, perhaps a language suggestion.
The site I am building will be hosted by IPowerWeb just for reference. Thanks in advance for any help or recommendations.
Mike.
ScaryBinary
06-10-2005, 09:20 PM
php (http://www.php.net/) works great with a MySQL (http://www.mysql.com) database. MySQL (http://www.mysql.com) has a direct php interface, and it's pretty straight forward and easy to use. Plus it's
fairly well documented (http://www.php.net/manual/en/ref.mysql.php). There are a bazillion books and websites dedicated to the php-MySQL combination.
I've heard Perl is nice, but I didn't like it...!
Make sure IPowerWeb allows scripting using back-end databases.
miggetyMike
06-11-2005, 12:24 PM
Thank you for the reply. How would I know the answer to this:
Make sure IPowerWeb allows scripting using back-end databases.
I know mySQL is installed on the server machine, but I'm sure there is more to the story than just that.
I will start by reading the tutorials for mySQL. Thanks again.
ScaryBinary
06-11-2005, 12:50 PM
IPowerWeb's "Businiess Pro" Package (http://www.ipowerweb.com/products/webhosting/index.html#1) says it supports both PHP and MySQL, as well as Perl and some other scripting capabilities.
I've never set this stuff up through a hosting site before, but iPowerWeb looks like a pretty nifty deal.
If you're not new to programming, you'll have no problems learning PHP. Try to find a few SQL examples to learn some basic database stuff.
SQLCourse (http://sqlcourse.com/) has some nice basic lessons and it is interactive so you can write your own queries and see what happens. Another great site is A Gentle Introduction to SQL (http://sqlzoo.net/). It breaks down the SQL syntax and explains how to get data, updated it, etc. It is also interactive and very well done.
miggetyMike
06-11-2005, 01:24 PM
Thank you very much for the help. I've been working my way through the MySQL tutorials. After I get a handle for this, I'll look at the interfacing to PHP. Thank you for the direction.
Mike.
miggetyMike
06-11-2005, 03:35 PM
OK after researching it looks like I must set up the database through IPowerWebs little interface. When I set up the fields obviously it lets me select from all of the available field types. These include VARCHAR, TINYINT, TEXT... to SET. How would I go about storing a random file? Would I do something like have a field for a file name? Thanks in advance!
ScaryBinary
06-11-2005, 05:20 PM
Originally posted by miggetyMike
OK after researching it looks like I must set up the database through IPowerWebs little interface. When I set up the fields obviously it lets me select from all of the available field types. These include VARCHAR, TINYINT, TEXT... to SET. How would I go about storing a random file? Would I do something like have a field for a file name? Thanks in advance!
I guess there are two approaches you could take. You could have a field of type BLOB (http://dev.mysql.com/doc/mysql/en/blob.html) which will allow you to store a binary file (BLOB stands for "Binary Large OBject, if I remember correctly). I believe this would allow you to store the file right in the database, though I have to admit I've never done it this way. Check out the comments at the bottom of the linked page above and see what other people say.
The other option is to do what you said, which is to just store the path and filename of the file in a TEXT (or VARCHAR) field. Then have your PHP script find the file once it grabs the path and filename from the database. You could use this, for instance, to create hyperlinks to the files.
Maybe someone else a little smarter in this area will jump in and explain if one method is better than the other....:cool:
miggetyMike
06-12-2005, 09:49 PM
Well i think it makes most sense to store it separately so its accessible outside of the database, does that make sense? Also, creating hyperlinks like you suggested would make it very easy to allow the user to download the file. It might take a little but more PHP work upfront to position and store the file correctly but it will definately keep the database simple. Thanks again for the reply. If anyone else has any tips feel free to inform!
SysOpt.com
Copyright Internet.com Inc. All Rights Reserved.