My current database looks like
CREATE TABLE sites(
siteId INT(11) AUTO_INCREMENT,
siteType VARCHAR(255),
siteName VARCHAR(255),
siteDomain VARCHAR(255),
PRIMARY KEY(siteId)
);
CREATE TABLE siteSites(
parentId INT(11),
childId INT(11)
)
I’m trying to join all the tables and fetch all data.
like:
<?php
$q=mysql_query("SELECT * FROM sites s1, siteSites, sites s2 WHERE s1.siteId=parentId AND s2.siteId=childId");
$row=mysql_fetch_array($q);
?>
and than i want to get both the info from ‘s1’ and ‘s2’ out of the $row variable.
is this possible and if it is than how do i do it?
thank you
1 Answer