Jump to content

Q for a guru - PHP and MySQL vs. 1 query in MSSQL


romba

Recommended Posts

Hi, I need some help with database queries and PHP script:

Let's think there are 2 tables with those fields:

 

table content - fields id, name, enabled (0 or 1)

table links - fields livelink, relatedlink

 

Related link contains the content's id and looks like this:

index.php?user=me&id=22

 

What I need is to print all the content names with the livelinks which are enabled:

<a href="livelink">Content name</a>

 

I heard the best is to store all the id from the "relatedlink string" into an array with the

 

livelinks and then loop it....

Is here anybody who knows how to make it? The links table can be huge and storing all the

 

id's from there looks to wasty for me. I was thinking about storing the id's from the

 

content table at first. But please be aware, that there can be problem selecting the related

 

links - i.e. "select .... where xxxxxxxid=11" can select even xxxxxid=111 or xxxxx115

 

Thanks for any advice!

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.