Re: retrieveing vars from mysql join ?
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Fri, 01 Dec 2006 08:26:58 -0500
= poster = wrote:
Hi all ,
I have the following problem :
$some_query = mysql_query(
"SELECT table1.id, table1.category, table1.author, table1.title, table2.title, table2.category FROM table1, table2
WHERE table1.category = table2.category ORDER by table1.id DESC");
while($record = mysql_fetch_array($some_query))
{
$mycategory = ($record['table1.category']);
$mytitle = ($record['table2.title']);
echo"$mycategory";
echo"$mytitle";
}
Does someone know what's wrong here ?
echo don't show the requested values ....
thanks !
A stupid question - but are you actually calling mysql_query() before trying the fetch the results?
Then try the following - and look at your index values:
echo "<pre>\n";
print_r($record);
echo "</pre>\n";
And finally, you can make things easier on yourself with something like:
"SELECT ... table1.category AS tab1category,
... table2.category AS tab2category ...
Also, if a column has a unique name in the tables listed in your FROM clause, just use the column name. You only need the table name when you have duplicate column names, as in category.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- retrieveing vars from mysql join ?
- From: = poster =
- retrieveing vars from mysql join ?
- Prev by Date: Re: is lisp better than php?
- Next by Date: Re: -> PHP4 Singleton implementation question <-
- Previous by thread: Re: retrieveing vars from mysql join ?
- Next by thread: Re: retrieveing vars from mysql join ?
- Index(es):
Relevant Pages
|