Jump to content


Photo

interactive databases..


  • Please log in to reply
2 replies to this topic

#1 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 13 May 2006 - 01:01 AM

anyone has good concept on how to make database that go with each other for easy use..

like if i got a pictures table..

i wanna know how i can make 2 tables one for albums and anothe rone for photo.. and mabey anothe rone for comment sone pictures.. if you get the idea..

like how can i identify one table with another..

because right now i got everything workgin the way i want.. but my database is a mess...

i got one for usr another for user pic another for comment another for picturs ..just a mess..

i want to learn how i can associated tables..

#2 Zubaz

Zubaz
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 13 May 2006 - 01:04 AM

The easiest way to do an albums/pictures structure is by having two tables, and then if you want comments, one more.

ALBUMS
----------
+ id
+ name
+ description
+ whatever

PHOTOS
---------
+ id
+ album_id (corresponds to the id column in ALBUMS)
+ caption
+ filename
+ whatever

COMMENTS
------------
+ id
+ photo_id (corresponds to id column in PHOTOS)
+ user
+ text
+ whatever else

#3 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 13 May 2006 - 01:16 AM

alright so can you give me a query example of how i could realte that phtop id with the comment photo id..

(inser into photo,comment where id=$)?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users