Forum Moderators: coopster

Message Too Old, No Replies

php mysql

need help with mysql design

         

loke

8:48 pm on Feb 12, 2004 (gmt 0)

10+ Year Member



hi,

I'm designing an admin page in order to easily add/change/delete some of my php & mysql driven pages. From the admin page I want to able to add/delete urls using formfields. In order to store it efficently I want to know the best way to store 1-50 urls in a mysql table. The table will contain page_id, page_name, page_title page_meta, etc, and of course page_href_urls

The problem is to how store the 1-50 urls in a suitable way.

anyone with a suggestion?

coopster

9:10 pm on Feb 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If I'm understanding you correctly, you want to have a database of what seems to be web site pages. The key seems to be each unique page of your site. The static data I would keep in one table, the varying data (URLs) I would store in a relational table and then use the page_id as the PRIMARY KEY:

pages


page_id
page_name
page_title
page_meta
etc.

pages_urls


page_id
page_href_urls

Now you can have 0 - n occurrences of URLs for each page.

coopster

9:20 pm on Feb 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Come to think of it, another variation on that design would be to add a type of some sort to the second table as you may have multiple
meta
elements per page as well.

pages


page_id
page_name
page_title
etc.

pages_urls


page_id
page_element_type
page_element_type_data

An example of the stored information in the second table might look something like this:


page_id...page_element_type...page_element_type_data
......1................meta...name="keywords" content="keyword1, keyword2"
......1................meta...name="robots" content="follow,index"
......1.................url...http://www.link1.com
......1.................url...http://www.link2.com
......1.................url...http://www.link3.com

loke

3:14 pm on Feb 13, 2004 (gmt 0)

10+ Year Member



thanks, your reply saved me a lot of time. Guess I need to read up on some mysql basics also...

ergophobe

8:31 pm on Feb 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




read up on some mysql basics

Loke, make that "database basics". I say that because this stuff is pretty much common to all relational databases, so you should not limit yourself to reading mysql-specific materials. You will often find better information on more general database sites when it comes to broad principles like that. I'm sorry I can't think of a resource to send you to right now, but perhaps someone else will.

Good luck,

Tom