Return all the mysql_fetch_object with an array - solved
Posted: Mon Jun 05, 2006 10:56 am
Hi, I have this portion of code that returns from sql - either a "describe" or a "select *".
Now the thing is this returns only the first row, for example running a "describe" from table A (name, address) would return only the name....
If I do this:
So I figured I must need an array for it...... just too tyred to think at the moment.
Regards, Bog
Code: Select all
if ($sqlViewType==="describe")
{
$sqlCmd = "$sqlViewType $sqlTableName;";
}
elseif ($sqlViewType==="select")
{
$sqlCmd = "$sqlViewType * from $sqlTableName;";
}
else
{
$this->sqlError = "please give a proper command \n\n";
return false;
}
if (! $this->Exec($sqlCmd))
return false;
$res = mysql_fetch_object($this->sqlHandler);
print_r($res);If I do this:
Code: Select all
if ($sqlViewType==="describe")
{
$sqlCmd = "$sqlViewType $sqlTableName;";
}
elseif ($sqlViewType==="select")
{
$sqlCmd = "$sqlViewType * from $sqlTableName;";
}
else
{
$this->sqlError = "please give a proper command \n\n";
return false;
}
if (! $this->Exec($sqlCmd))
return false;
$res = mysql_fetch_object($this->sqlHandler);
print_r($res);
$res = mysql_fetch_object($this->sqlHandler);
print_r($res); /////////// here I just doubled the $res and the print --- so now I have the address returned alsoRegards, Bog