please help...php and mysql

jpbaseball1322

New Member
Hi I need to set up a web page in which I am able to upload and view pictures using php and mysql. To start I have determined 3 steps:

1) Develop my database schema. I believe I need 3 tables. One will be an albums table containing and ID, title, create date, and modify date. The second will be a photos album containing and ID, title, caption and album it belongs to. The third is supposed to somehow connect the two, but I have no idea how to do that.

2) Upload some photos to the tables. - feel like I can do this simply enough

3) Write code to display all the pics from albums in my datapase using php.

Can anyone help me, in particular with step 1 and 3. I don't want this done for me, rather just looking for some advise so I can work on this and LEARN it. Thanks a lot!
 

craftygeek

New Member
I assume that you have a local test server running that you're working on that runs on WAMP, LAMP or MAMP....this should have phpmyadmin on it (I think they all do) - setting up tables in that is easy...much easier than doing it through php.

1: The 3rd table is a linking table & is used for reference purposes that will have 3 fields, ID, tableID & PhotoID....if using a linking table you don't need the album field in the Photo table.
So in the linking table an entry specifies what album a photo belongs to - this way a photo can be put in multiple categories, whereas if you had the albumID in the photo table, each photo would only be able to be put in a single category.
In this case, a linking table may not be needed - but it is good practice for more complicated setups where it is required.

3: you'll need to set up a MySQL query that pulls out the relevant info from the database, then spit out the correct bits out into html code...pretty straight forward to do.

If you're daunted by doing this - there are many pre-coded galleries on the net that you can download & essentially plug into your site...there are some nice Jquery ones, I used this one recently:
Galleriffic

Using this, I used php to insert the images into the correct html code - much as you need to do in this case. Not knowing what the site is, or what style or photos they are, I don't know what sort of gallery you need.
 
Top