View Single Post
Old 09-14-2012, 06:53 PM   PM User | #1
cloudstryphe
New Coder

 
Join Date: Mar 2012
Posts: 62
Thanks: 7
Thanked 0 Times in 0 Posts
cloudstryphe is an unknown quantity at this point
Returning only 1 row

Hello all,

I'm running an sql query that joins 2 tables for stock information.

Table 1 has user id's and stock ids, table 2 has stockids and stock information.

I joined the tables so that I could query the stock information where the users have the stock id's

Code:
$query="SELECT `cosymbol` FROM `app_stockslist` 
		INNER JOIN `user_stocks` ON app_stockslist.stockid = user_stocks.stockid WHERE `userid`='$userid'";
$result=mysql_query($query) or die(mysql_error());
$array=mysql_fetch_array($result);
print_r($array);
When I run this exact same query in the PHPMyAdmin interface, it will return however number of rows correspond with the userid. When I run it via php on my webpage, it always just returns one row. Any Ideas?
cloudstryphe is offline   Reply With Quote