Issue with IF statement in CodeIgniter
I have a slight issue with this statement. I'm using the CodeIgniter Framework and it seems to bring back 3 and 5 everytime but I can't figure out why.
$row->gType has a different value each time $row2->tcID just links to gType and I'm grabbing the map and type.
<?
foreach ($stats as $row){
foreach ($gametypes as $row2){
if($row2->tcID = $row->gType){
$map =开发者_Go百科 $row2->mName;
$type = $row2->gtName;
}
}
?>
$row->gType goes through the values 2 and 1 in this circumstance. I echoed values in the script to check.
Any idea where I'm going wrong here?
Ok, so this was a silly mistake. Probably just reading over it too quickly. Comparison in the IF statement was incorrect.
<?
foreach ($stats as $row){
foreach ($gametypes as $row2){
if($row2->tcID == $row->gType){
$map = $row2->mName;
$type = $row2->gtName;
}
}
?>
精彩评论