Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP > PHP Application Design
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Feb 2, 2005, 17:45   #1
benrud
SitePoint Enthusiast
 
Join Date: Feb 2005
Posts: 63
make some cash if u can help with this tutorial

Here’s the deal… I need help with this tutorial (http://www.sitepoint.com/article/php...system-minutes) and I’m willing to pay/make a donation to anyone who can and will help me.

I currently have no programming or data base experience but I’m enrolled in a basic web programming class at my local community college. What I need to do is get this tutorial working on my site with a few minor changes.
- I need to add additional fields besides “caption” to each photo (meta keywords, meta description, page title, featured products)
- I need each photo to belong to a category AND an album. Each photo will only belong to one category & album and each album will belong to only one category.

An example of what I want my photo album database to do can be found at the following addresses.

Example of an album page from the lake category - http://benrud.net/pics/lake/2004_lak...rial_day.shtml

Example of a photo page from a the memorial day album in the lake category - http://benrud.net/pics/lake/2004_lak...u/amanda.shtml

Please e-mail me at todd@benrud.net if you are interested in trading some help for some cash.

Thanks for your time and assistance.

Benrud
benrud is offline   Reply With Quote
Old Feb 2, 2005, 21:14   #2
McGruff
simple tester
 
McGruff's Avatar
 
Join Date: Sep 2003
Location: Glasgow
Posts: 1,685
No cash required here.
McGruff is offline   Reply With Quote
Old Feb 3, 2005, 14:13   #3
benrud
SitePoint Enthusiast
 
Join Date: Feb 2005
Posts: 63
So if I'm new to php/mysql and I want to get the photo album tutorial (http://www.sitepoint.com/article/ph...-system-minutes) to work for me, what is my first step? I need to upload more information about the file than category, file and caption. I also need to organize in terms of "categories" and "albums". I'm not sure how to organize the sql tables.

any ideas?

I was thinking about working on the tutorial without any changes, but a lot of the examples/explanations are over my head as they are and could really use some help.

Any suggestions?
benrud is offline   Reply With Quote
Old Feb 3, 2005, 16:06   #4
swdev
SitePoint Wizard
 
swdev's Avatar
 
Join Date: Oct 2004
Location: UK
Posts: 1,053
I haven't read the tutorial, but here are some thoughts

Category table
===========
category_id integer auto_increment primary key -- the primray key for this table
category_name varchar(255) -- the name of this category
other columns


Album table
=========
album_id integer auto_increment primary key -- the primary key for this table
album_name varchar(255) -- the name of this album
category_id -- foreign key to link this album to the category table
other columns

Photo table
=========
photo_id integer auto_increment primary key -- the primary key for this table
album_id -- foreign key to link this image to the album table
caption varchar(255) -- caption for this picture
location varchar(255) -- location of this picture e.g. /home/wwwroot/images
other columns here

This table layout assumes
  • An album belongs to exaclty 1 category
  • A photo belongs to exactly 1 ablum, and hence 1 category

In order to upload more information, just add the relevant form fields to the correct form.
Then, in the code where the fields are added to the database. just add the new fields to the SQL statements to update the relevant tables.

I hope this gives you a start.

Give it a try, and post you code / errors if you hit any problems.
swdev is offline   Reply With Quote
Old Feb 3, 2005, 16:54   #5
benrud
SitePoint Enthusiast
 
Join Date: Feb 2005
Posts: 63
swdev,

Thanks a ton!!! I'm working through a few projects out of another book to get a better understnadings of the basics and then I'm going to tackle the photo album. I'll most likely start it on Monday.

Have a great weekend and thanks again!

todd
benrud is offline   Reply With Quote
Old Feb 3, 2005, 17:07   #6
benrud
SitePoint Enthusiast
 
Join Date: Feb 2005
Posts: 63
swdev,

maybe u can help with this one? I'm working on my first php/mysql application. One that manages contact info. The form (http://benrud.net/php/mailman.php) is supposed to let someone logon and manage their account, but when I enter username/password for admin (admin/entry) I get "Could not open db118613358". I don't know if this is the reason, but there is no place for the db password. Is this required for a user to access his/her account?

The username admin with pw retry is in the "users" table of database db118613358.

Thanks for your and anyone elses help!

todd

The code for trylogon.php is below

PHP Code:

<?php 

$connection
= mysql_connect("db151.perfora.net");
$db = "db118613358";
mysql_select_db($db, $connection) or die( "Could not open $db");
$sql = "Select * from users where username = '$username' and password = '$password'";
$result = mysql_query($sql, $connection) or die( "could not execute sql: $sql");
$num_rows = mysql_num_rows($result);
if (
$num_rows > 0 ) {
    
header( "Location: mailman_main.php" );
    } else {
        
header ("Location: failedlogon.php" );
        }
?>
benrud is offline   Reply With Quote
Old Feb 3, 2005, 16:57   #7
swdev
SitePoint Wizard
 
swdev's Avatar
 
Join Date: Oct 2004
Location: UK
Posts: 1,053
you're welcome
swdev is offline   Reply With Quote
Old Feb 3, 2005, 17:15   #8
swdev
SitePoint Wizard
 
swdev's Avatar
 
Join Date: Oct 2004
Location: UK
Posts: 1,053
Read the manual for mysql_connect
parameter 1 - the name of the database server
parameter 2 - the user to logon to the database server
parameter 3 - the password for this user

This user/password is the user for the database, not your user.
swdev is offline   Reply With Quote
Old Feb 3, 2005, 17:27   #9
benrud
SitePoint Enthusiast
 
Join Date: Feb 2005
Posts: 63
Thanks for the link. It looks like it's working now.

I needed to have this
--- $connection = mysql_connect('db151.perfora.net', 'dbo118613358', '*******');

not this
--- $connection = mysql_connect('db151.perfora.net');

This would be impossible without help from good people like yourself!
Thanks!
todd
benrud is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 14:50.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved