![]() |
|||
PHP
IT Tags
Overlapping Layers mysql server connection to MYSQL ajax objects control panel Solr XML local server XHTML my_thread_global_end associative arrays Mobile site check domain photo gallery Combo box indexing solr local server Remove Duplicate magento ecommerce SimpleXML Stop Script sdf UPDATE server shutdown include PHP and FLash multiple file uplo php mail Simplexml Parser Xampp |
combining tablesDear sir / madam How do i merge/combine this query: "SELECT ".$GLOBALS['pages'].".*, ".$_SESSION['pages_content'].".title, ".$_SESSION['pages_content'].".label FROM ".$GLOBALS['pages'].", ".$_SESSION['pages_content']." WHERE". Into this one: The last query works but i need to replace the title and label data form another table (pages_content) as is done in the first query how on earth can i combine the two or fit in two? left outer joins Sincerly K. CommentsIve got it Here u go after hours of pain ive got the query for the following function to print out a list with values from a main table with data and a language or content tabel with title and urllabel in a session Download a copy of ddsmoothmenu and enjoy $query = "SELECT a.ID, a.parent, (SELECT title FROM ".$_SESSION[\'pages_content\']." WHERE parent = a.ID) as title, (SELECT label FROM ".$_SESSION[\'pages_content\']." WHERE parent = a.ID) as label, a.link, a.sequence, Deriv1.Count FROM ".$GLOBALS[\'pages\']." a LEFT OUTER JOIN (SELECT parent, COUNT(*) AS Count FROM ".$GLOBALS[\'pages\']." WHERE menu=\'top\' GROUP BY parent) Deriv1 ON a.ID = Deriv1.parent WHERE a.parent=" . $parent1 . " AND menu=\'top\' order by sequence ASC"; This is the function function menutop($parent1, $id) { $resultmax = mysql_query("SELECT max(sequence) as maxseq FROM ".$GLOBALS[\'pages\']." WHERE (parent=\'$parent1\' AND menu=\'top\') order by sequence ASC") $result = mysql_query($query); echo "<ul>\\n"; while ($row = mysql_fetch_assoc($result)) { if(strlen($row[\'title\'])>30){$row[\'title\'] = "".substr($row[\'title\'],0,30)."...";} $class = "menuitem"; if ($row[\'Count\'] > 0) { menutop($row[\'ID\'], $id); echo "</li>\\n"; } elseif ($row[\'Count\']==0) { echo "<li><span class=\\"".$class."\\"><a href=\\"" .$url . "\\">" . $row[\'title\'] . "</a></span></li>\\n"; } else; } |
