Based on the snippet you have sent us you need
to at least start by enclosing your column names
in your accesses to the associative array containing
your results.

Each line just use print_r or var_dump:

while($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
        print_r($row);
}


This will show you exactly what is going on. Verify
that your results are actually there as well.

As a final note the actual problem appears to
be that you are not accessing the associative
array elements with quotes:

echo $row["wwwpages.name"];

Instead of:

echo $row[wwwpages.name];

This should show you what is going on and help you
easier determine what is going wrong, it is possible
you are not returning any data with your query as
well.

Thanks

Jeremy Allen


-----Original Message-----
From: Ralph Guzman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 31, 2001 5:07 AM
To: PHP General Mailing List
Subject: [PHP] PEAR DB Results


I am trying to do a joined query using PEAR DB? My code looks something like
this:

$sql = "SELECT wwwpages.pid,wwwpages.name,media.pid,media.name FROM
wwwpages, media WHERE wwwpages.pid = '$pid'";

if(DB::isError($result = $db->query($sql))){
echo "ERROR:" . DB::errorMessage($result);
} else {

while($row = $result->fetchRow(DB_FETCHMODE_ASSOC)){
echo $row[wwwpages.name];
echo $row[media.name]
}
}

When I specify '$row[wwwpages.name]' I get a blank result, and if I try
'$row[name]',  I am obviously not specifying a table therefore it results in
name for wwwpages table. How do I go about displaying both?


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to