Jump to content

Array not holding all values


dbutler

Recommended Posts

below is a snippet of code I have in my application:

$glid = 39102;$query = "select distinct account from PROJECTS where glid='$glid' order by account";$result = mysql_query($query) or die ("Couldn't select distinct accounts");$row = mysql_fetch_array($result, MYSQL_ASSOC);foreach ($row as $account)	{	echo "account $account<br>\n";		}print_r($row);

when I run this I get a single account echoed from the foreach statement and the print_r shows me the array with a single item in it as below (this is the screen output of the above):account LEADJArray ( [account] => LEADJ ) My issue is that when I run the $query above directly in MySQL, I get a list of 24 accounts, not just the one that is output from my code. Can anyone think of why this is the case? I have tried MYSQL_NUM and MYSQL_BOTH as well in the fetch array function but neither of those made a difference. Any help is appreciated...drb

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...