Im trying to put together a script that allows me to display links dynamically on my site.
I have 2 tables. The first one, domains can have two values per row. These being, domId and domain. The next table, links can contain a few values per row, the ones im working with here are domId(matches the domId of the domains table) desc and `link’.
Here is my query so far:
$linkQuery2 = 'SELECT `link`,`desc`,`domId`
FROM `links`
WHERE `catId`="'.$pageCat.'"
&& (`modId`="1" || modId="'.$pageModel.'")
ORDER BY `domainId` ASC
LIMIT ' . $from . ', ' . $max_results2;
Here is the code that im using to display the info i need:
$linkLoop2 = '';
$linkAd = $row['link'];
$linkDesc = stripslashes($row['desc']);
$linkDomain = stripslashes($row['id']);
$linkLoop = '<ul class="bymodel-dllinks">';
$linkLoop2 .= '<li><a href="'.$linkAd.'" target="_tab">'.$linkDesc.' '.$linkDomain.'</a></li>';
$linkLoop3 = '</ul>';
What I am trying to do is find a way so that when $linkDomain is echo’d it will display the text i have stored in the domain field on the domains table. Currently when $linkDomain is echo’d, it will display 303, which is the domId of the site i will be linking to.
Use Join to select domain name from domainstable :