Multiple columns, different tables, same names
| From: | Nancy Milligan | Date: | Wed, 16 Apr 2003 17:38:07 +0000 |
| Subject: | Multiple columns, different tables, same names | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4887@lists.php.net to get a copy of this message | ||
I'm trying to fetch some data from different tables, but some have the same
column name. It seems like my DB.php is just returning the first column.
Am I doing something wrong?
$sql=<<<ENDSQL
SELECT spells.name, classes.name, spellinfo.level
FROM spells, recipes, components, classes, spellinfo
WHERE components.name RLIKE '$Item' AND
recipes.componentid = components.id AND recipes.spellid = spells.id
AND classes.id = spellinfo.classid AND spells.id = spellinfo.spellid
AND classes.name RLIKE '$Class';
ENDSQL;
$result=$dbconn->query($sql);
print $result;
if (DB::isError($result))
{
die($result->getMessage());
}
if ($Search=="spell")
{
while ($result->fetchinto($row))
{
foreach($row as $key => $value)
{
print "$key => $value<br>\n";
}
}
}
$result->free();
?>
Nancy