In turns of users interacting with a page what Null is equivalent for when I users click on link let say or not, In this case will Null be equal to a users haven't click on? and !is_null would be equal to a users has click on?
am i wrong?
I posted this thread in another forum and somebody told me that
$submenu is being used as a marker to process the inner SELECT only on the first time round the outer SELECT
I didn't undertood what is he telling me can anybody phrase in another manner, I am new to php.
$submenu = false;
$cat = isset($_GET['subject']) && is_numeric($_GET['subject'])?$_GET['subject']:null;
$prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null;
$menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null;
$sql = 'SELECT id,Subject FROM menusubjects;';
$result = mysql_query($sql);
if($result && mysql_num_rows($result)!=0) {
echo '<ul id="nav-categories">';
while($row = mysql_fetch_assoc($result)) {
$uri = 'example1.php?subject='.urlencode($row['id']);
$class = !is_null($cat) && $cat==$row['id']?' class="selected"':'';
echo "\t",'<li',$class,'><a href="',$uri,'">',$row['Subject'].'</a>';
if($submenu==false && !is_null($cat) && $cat == $row['id']) { // line 58
$sql2 = 'SELECT id,shoename FROM regularmenu WHERE menusubject_id = '.mysql_real_escape_string($cat).';';
$result2 = mysql_query($sql2);
if($result2 && mysql_num_rows($result2)!=0) {
echo "\n\t\t",'<ul class="submenu">',"\n";
while($row2 = mysql_fetch_assoc($result2)) {
$uri2 = $uri.'&menu='.urlencode($row2['id']);
$class2 = !is_null($prod) && $prod==$row2['id']?' class="selected"':'';
echo "\t\t\t",'<li',$class,'><a href="',$uri2,'">',$row2['shoename'],'</a></li>',"\n";
}
echo "\t\t",'</ul> <!-- end of ul.submenu -->',"\n";
}
$submenu = true;
}
echo '</li>',"\n";
}
echo '</ul> <!-- end of ul#nav-categories -->',"\n
this is the whole script and it's set variables on top.