mysql_fetch_array() giving numerical keys in foreach loop

I'm using the below code to create content using a foreach loop.  The problem is that when the if-conditional is checked the $key is an integer instead of the string I expected it to be.  Obviously the condition would always be false, then.  Is this something I'm doing wrong.
Also, would you mind reminding me how to do a compound or statement without repeating the variable every time like I did below?
Is it if($key == (value||value||value||etc.)?
$query = "SELECT*,
                MATCH($in) AGAINST('$search_query' IN BOOLEAN MODE) AS score
                FROM musicfiles
            WHERE MATCH($in) AGAINST('$search_query')
            ORDER BY score desc";
if($DEBUG){
	print $search_query;
	print "<br />";
	print $query;
	print "<br />";
}
 
$result = mysql_query($query);
$i=1;
print '<div id="totalInfo">Found ';
print mysql_num_rows($result);
print ' matches.</div>';
while($row = @mysql_fetch_array($result)){
	print '<div name="'.$result['filepath'].'" class="trackContainer ';
	if ($i % 2){
		print "odd";
	}else{
		print "even";
	}
	print '">';
	
	print '<div class="imageContainer" style="background-image: url(\'Images/';
	print $row['ext'];
	print '.png\');"><input class="selection_checkbox" type="checkbox" /></div>';
	print '<div class="infoCont">';
	print '<div class="tbInfoCont">';
	
	foreach($row as $key=>$value){
		if( $key =='score'||$key == 'fileid'||$key == 'filepath'||$key == 'ext'||$key == 'filesize'||$key == 'length' ){
			print '';
		}else{
			print '<div class="fl ';
			print $key;
			print '">';
			if($key=='track' && $value == 0){
				print "??";
			}else{
				print $value;	
			}
			print "</div>";
		}
	}
	
	if($DEBUG){
		print $row['score'];
	}
	
	print '</div>';
	print '</div>';
	print '</div>';
	
	$i++;
}

Open in new window

LVL 4
khsaterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Roger BaklundCommented:
Use mysql_fetch_assoc() to get string keys:

http://php.net/manual/en/function.mysql-fetch-assoc.php
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Roger BaklundCommented:
>> Also, would you mind reminding me how to do a compound or statement without repeating the variable every time like I did below?

Try like this:
if(in_array($key,array('score','fileid','filepath','ext','filesize','length'))) {

Open in new window

0
khsaterAuthor Commented:
That isn't exactly what I'm going for.  I want to know if $key is currently any of those strings.
0
khsaterAuthor Commented:
Oh never mind I understand what you're doing now.
0
khsaterAuthor Commented:
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.