Jump to content

OceanIdiot

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

OceanIdiot's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $this is used in PHP Object Oriƫntated programming. Maby you understand it if by looking at this example: <?php class car { public function setColor($color) { $this->color = $color; } public function getColor() { return($this->color) } } $car = new car(); $car->setColor("blue"); echo($car->getColor()); ?> You can only use $this in a class (object context).
  2. I'm trying to make a dynamic menu. It goes pretty well, but I'm stuck now. If every headmenu has one submenu, every thing is okey, but if they have 2+ submenus then the head menu will be echoed once for every submenu.. I know why (in the same while loop) but I just do not know how to solve :/ Here's my code: <?php include('../config.php'); $sql_submenu = mysql_query("SELECT `mm_submenu`.`name` AS `submenu_name`, `mm_submenu`.`headmenu`, `mm_submenu`.`link`, `mm_submenu`.`order`, `mm_headmenu`.`name` AS `headmenu_name`, `mm_headmenu`.`alias`, `mm_headmenu`.`order` FROM `mm_submenu`, `mm_headmenu` WHERE ( `mm_headmenu`.`alias` = `mm_submenu`.`headmenu` ) ORDER BY `mm_headmenu`.`order`, `mm_submenu`.`order`") or die(mysql_error()); while($row_submenu = mysql_fetch_array($sql_submenu, MYSQL_ASSOC)) { echo($row_submenu['headmenu_name']. "<br />"); echo(" ". $row_submenu['submenu_name']. "<br />"); } ?>
×
×
  • 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.