Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

elephant

macrumors newbie
Original poster
Feb 5, 2009
25
0
London, UK
I have very limited knowledge in php and MySQL, but I want to implement some stuff on a website I'm making. Could anyone with knowledge in php and MySQL just check if I'm going about this in the correct way, or if I'm making it way too complicated?

What I want to do is to make an event list for a band. I want them to have a private html on their site that contains a simple form. In this form you input name of the venue, link to the venue, location (town), location (country), date of the gig and time of the gig.

Here comes the php/MySQL part. I want the format displayed on the main site to be:

<Date>, <Time>
<NAME OF VENUE>, <Town>, <Country>
<Link to website of venue> (presented in "click here" format)

So the way I was thinking of doing it would be:

Create 6 different tables in a database called xxxx_events, one for every entry.

Then just call them from the main site, something like this:

Code:
echo('<div class="events">
<p><b>'.$date.', '.$time.'</b></p>
<p><b>'.$venue.', '.$town.', '.$country.'</b></p>
<p><a href="'.$link.'">Click here for directions and information</a></p>
</div>');

Would this work?
 
That won't work. First, you should put all the information into one table. Just because you have 6 items doesn't mean you want 6 tables. That would be you would have 6 one-entry tables, essentially a list, with no correlation between them. Databases are meant to have data. Six entries in one table is tiny. Also, you won't have to worry about projecting data this way which I'm sure you won't need to do if you're simply just outputting the same information that was put there in the first place.

Also, to get info out of the database you need to make sql calls within php. When you do that you can set the variables you have equal to whatever you're trying to get our of the db. Not sure if you already know this or not.
 
That won't work. First, you should put all the information into one table. Just because you have 6 items doesn't mean you want 6 tables. That would be you would have 6 one-entry tables, essentially a list, with no correlation between them. Databases are meant to have data. Six entries in one table is tiny.
Ok, so one table containing all the information will do fine, got it.

Also, you won't have to worry about projecting data this way which I'm sure you won't need to do if you're simply just outputting the same information that was put there in the first place.
I'm starting to get lost here. :D

By "projecting data", do you mean the way I want to present it on the website?

Also, to get info out of the database you need to make sql calls within php. When you do that you can set the variables you have equal to whatever you're trying to get our of the db. Not sure if you already know this or not.
Yeah, I didn't include all the code needed in my example of course. I understand that there has to be sql calls and such, and that I can format the way the date is presented (for example 20 Oct 2009).

Right now I've made a very simple shoutbox on the website (http://s77028.gridserver.com/), which I made from this tutorial: http://net.tutsplus.com/tutorials/php/create-a-basic-shoutbox-with-php-and-sql/

To display the comments in the shoutbox I've done this:

Code:
echo('<li><div class="shout"><p><b>- '.$epost.'</b> /'.$ename.'</p></div></li>');

My plan was to base my event list creation on the same principals I've picked up through that tutorial. But you're saying there's an easier way perhaps?

If you know of any very easy-to-follow tutorials for creating an event list, let me know!
 
Oh, and just so I'm clear on the basic principal:

To make an event list, I would just

1. Input data into a database (through a form in my case)
2. Pull the data from the database
3. Format the data using php
4. Present it on the website using CSS

Have I understood the basics of it?
 
I'm starting to get lost here. :D

By "projecting data", do you mean the way I want to present it on the website?

By projecting data I meant that you don't need multiple tables where you need to match them up. For instance, many times people will assign a key to a certain value (number value for a url). Data for that url would go into another table using the key of the first table. You can then project (match keys) to get all of the data. The reason I don't recommend you doing something like this is that you don't have a ton of data where you will need different pieces of it. Basically the main purpose of using the "key" way is that it allows you to relate different sets of data together.

All you are doing is saving/retrieving the same simple data. This is why one table will work for you.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.