ok I am trying to do a call of a menu using OOP with mysql
basically
It will call down the main menu in a loop, then if that menu has a submenu it will try and call the submenu with ANOTHER query....this is where my dillema comes in, OOP isn't letting me do multiple queries...
here is my class
class DB
{
var $host = '';
var $user = '';
var $password = '';
var $database = '';
var $conn = NULL;
var $result = false;
function DB($host, $user, $password, $database)
{
$this->host = $host;
$this->user = $user;
$this->password = $password;
$this->database = $database;
}
function open()
{
$this->conn = mysql_connect($this->host, $this->user, $this->password);
if (!$this->conn) {
return false;
}
if (@!mysql_select_db($this->database, $this->conn)) {
return false;
}
return true;
}
function close()
{
return (@mysql_close($this->conn));
}
function error()
{
return (mysql_error());
}
function query($sql)
{
$this->result = @mysql_query($sql, $this->conn);
return ($this->result != false);
}
function affectedRows()
{
return (@mysql_affected_rows($this->conn));
}
function numRows()
{
return(@mysql_num_rows($this->result));
}
function fetchObject()
{
return (@mysql_fetch_object($this->result, MYSQL_ASSOC));
}
function fetchArray()
{
return (@mysql_fetch_array($this->result, MYSQL_NUM));
}
function fetchAssoc()
{
return (@mysql_fetch_assoc($this->result));
}
function freeResult()
{
return (@mysql_free_result($this->result));
}
}
here is the coding I use to call it, essentially trying to make the menu
$query = $db->query("SELECT * from gamemenu where gid = 1 and dep = 0");
while ($row = $db->fetchAssoc()) {
if ($row['link'] == 1) {
echo '<a href="" class="bluelink"><B>'.$row['name'].'</B></a><BR>';
}
if ($row['link'] == 0) {
echo '<font class="bluelink"><B>'.$row['name'].'</B></font><BR>';
$query1 = $db->query("SELECT * from gamemenu where gid = 1 and dep = $row[id]");
while ($row1 = $db->fetchAssoc()) {
echo ' <img src="/images/1010bullet.gif"><font size="1" color="FFFFFF"><a href="/" class="sublink">'.$row1['name'].'</a></font><BR>';
}
}
}
any help woudl be greatly appreciated I am so stuck...😕