Jump to content

what is the best way to set this up


ccrevcypsys

Recommended Posts

I am trying to make a new thing on my site where people can add favorite links. Is this a good way to set up the tables?

 

---customer---        ---yourLinks---        ---yourLink_txt---

  customer_id ---+          link_id    ---+---      link_id

                        +---  customer_id                text1

                                    link1                      text2

                                    link2                      text3

                                    link3                      text4

                                    link4                      text5

                                    link5                      text6

                                    link6

 

but i also want to add shortcut images and how many times you click through the link. Can somone help me reform the table to be able to do that?

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/76556-what-is-the-best-way-to-set-this-up/
Share on other sites

Not that way

make the table

 

LinkID (auto Increment P-key)

UserID (From your users table)

Link (VarChar 128 absolute link)

 

Then when you want to retrive a users links says select Link from `Table` Where UserID = '".$userid."'";

 

Much easier, its just a big old list of stuff

well you have a users table and a links table so 2 tables, but you can just run a test saying

count(*) from `links` where Userid = '".$userid."'";

 

and if the count is <= 5 add, otherwise alert, or if you don't expect to expand make a single row in a table what ever floats your boat

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.