Jump to content

variable as array key


jcanker

Recommended Posts

yes, but without the quotes

 

Rather, use double quotes, that way if you ever need a literal part, it is useable.

 

ie:

 


$res=mysql_query($query);
while($row=mysql_fetch_assoc($res)){
    
    $tempId=$row['id'];
    
    if($_REQUEST["fieldNumber$tempId"]>0){ //<-- see here 
        
        //do something
        
    }//end if
    
}//end while

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.