User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

Reply
Thread Tools Display Modes
Unread 5 Jan 2004, 21:09   #1
Supernova9
m u p p e t
 
Join Date: May 2001
Location: Whenever Wherever
Posts: 477
Supernova9 is infamous around these parts
PHP/MySQL Design Question

Ok,

I'm not new to databases, but I am new to mySQL.

To sort of learn the ropes I'm trying to design a basic calendar system, which has 3 tables.

User, Location and Event.

The users create events which take place at one of a number of locations. That will be the relational part, but what I don't know is, how do I create said relationships? It's not like access, I don't have a lookup wizard field type
__________________
Supernova9 is offline   Reply With Quote
Unread 5 Jan 2004, 21:23   #2
meglamaniac
Born Sinful
 
meglamaniac's Avatar
 
Join Date: Nov 2000
Location: Loughborough, UK
Posts: 4,059
meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: PHP/MySQL Design Question

When you say "create the relationships" what exactly do you mean?
Link the tables in some way so that altering something in one alters fields in another, or what?
__________________
Worth dying for. Worth killing for. Worth going to hell for. Amen.
meglamaniac is offline   Reply With Quote
Unread 5 Jan 2004, 21:43   #3
Supernova9
m u p p e t
 
Join Date: May 2001
Location: Whenever Wherever
Posts: 477
Supernova9 is infamous around these parts
Re: PHP/MySQL Design Question

Quote:
Originally Posted by meglamaniac
When you say "create the relationships" what exactly do you mean?
Link the tables in some way so that altering something in one alters fields in another, or what?
Say I create a location of "pub", and that has location_id 1,

A user then creates event "piss-up", and wants to set that as taking place in the pub.

I want them to be able to select "pub" from a list of options, and then when they select that, have 1 (the location id of the pub) put into the location field on the events table.

Am I right in thinking this is something I'd be coding in php rather than in the actual design of the database?
__________________
Supernova9 is offline   Reply With Quote
Unread 5 Jan 2004, 23:45   #4
xtothez
ŻŻŻŻŻŻŻŻŻ
 
xtothez's Avatar
 
Join Date: May 2001
Location: Sept 2057
Posts: 1,813
xtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud of
Re: PHP/MySQL Design Question

You'd use the pub table to generate a html selection box with php*, using the pub name as the options, with the id as the actual values sent. Then insert that into the events.
If you're looking to enforce referential integrity (making sure one table correctly references the information in another, like in access above), you may be out of luck, as MySQL doesn't support foreign keys in a default setup. Although on this level, you don't really need that if you're only allowing input from a limited set of values anyway.

*Select * from location, then while() through the list printing an <option> for each.
__________________
in my sig i write down all my previous co-ords and alliance positions as if they matter because I'm not important enough to be remembered by nickname alone.
xtothez is offline   Reply With Quote
Unread 5 Jan 2004, 23:56   #5
Supernova9
m u p p e t
 
Join Date: May 2001
Location: Whenever Wherever
Posts: 477
Supernova9 is infamous around these parts
Re: PHP/MySQL Design Question

Quote:
Originally Posted by xtothez
You'd use the pub table to generate a html selection box with php*, using the pub name as the options, with the id as the actual values sent. Then insert that into the events.
If you're looking to enforce referential integrity (making sure one table correctly references the information in another, like in access above), you may be out of luck, as MySQL doesn't support foreign keys in a default setup. Although on this level, you don't really need that if you're only allowing input from a limited set of values anyway.

*Select * from location, then while() through the list printing an <option> for each.
Thanks.
__________________
Supernova9 is offline   Reply With Quote
Unread 11 Jan 2004, 20:17   #6
[coza]
Registered User
 
Join Date: Jan 2004
Posts: 3
[coza] is an unknown quantity at this point
Re: PHP/MySQL Design Question

dont think calander is the sort of thing u wanna start on iff yer n00b
[coza] is offline   Reply With Quote
Unread 11 Jan 2004, 21:25   #7
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: PHP/MySQL Design Question

A calendar isn't a particular complex thing to implement. In fact on the contrary, I think that it's a great idea for learning; things that actually 'do' something when you finish them are infinitely more interesting than random 'SELECT * FROM...' snippets as you try and figure out what goes where and make it much more likely that you'll both persevere and that you'll endevour to go that little bit further to learn.
__________________
You're now playing ketchup
pablissimo is offline   Reply With Quote
Unread 11 Jan 2004, 22:17   #8
xtothez
ŻŻŻŻŻŻŻŻŻ
 
xtothez's Avatar
 
Join Date: May 2001
Location: Sept 2057
Posts: 1,813
xtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud ofxtothez has much to be proud of
Re: PHP/MySQL Design Question

Ignore coza.
Usual trolling, and still not very good at it.
__________________
in my sig i write down all my previous co-ords and alliance positions as if they matter because I'm not important enough to be remembered by nickname alone.
xtothez is offline   Reply With Quote
Unread 11 Jan 2004, 23:02   #9
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: PHP/MySQL Design Question

I thought I'd try shooting him down with logic and reason though =(
__________________
You're now playing ketchup
pablissimo is offline   Reply With Quote
Reply



Forum Jump


All times are GMT +1. The time now is 17:05.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright İ2002 - 2018