a1amattyj Posted February 23, 2010 Share Posted February 23, 2010 Really odd, thanks in advance! while($row = $db->fetch_array($query)) { if($row['clan'] > 0) { $query2 = $db->query(__FILE__,__LINE__,"SELECT * FROM `".DB_PREFIX."clans` WHERE `id` = '".$row['clan']."'"); if($db->num_rows($query2)) { $clDa = $db->fetch_array($query2); $row['clanname'] = $clDa['name']; } } if(isset($row['clanname'])) { echo "EXISTS<br />"; } else { echo "nothing wrong with that..<br />"; } if(isset($town[$row['town']])) { $row['city'] = $town[$row['town']]; } $assign[] = $row; if(!isset($assign['clanname'])) { echo "should show the name right here..<br />"; } else { echo "brilliant<br />"; } outputs: EXISTS should show the name right here.. nothing wrong with that.. should show the name right here.. EXISTS should show the name right here.. EXISTS should show the name right here.. EXISTS should show the name right here.. nothing wrong with that.. should show the name right here.. nothing wrong with that.. should show the name right here.. Link to comment https://forums.phpfreaks.com/topic/193107-array-var-not-passing-itself-on/ Share on other sites More sharing options...
jl5501 Posted February 23, 2010 Share Posted February 23, 2010 how are you expecting $assign['clanname'] to be equal to anything. you are assigning to $assign using [] so $assign[0]['clanname'] or $assign[1]['clanname'] but never $assign['clanname'] Link to comment https://forums.phpfreaks.com/topic/193107-array-var-not-passing-itself-on/#findComment-1016957 Share on other sites More sharing options...
ialsoagree Posted February 23, 2010 Share Posted February 23, 2010 $assign[] = $row; // assign $row to $assign's next index, NOT to $assign itself. if(!isset($assign['clanname'])) // check the $assign array for an index called 'clanname' - you did NOT assign this in the line above I think what you meant to do is: $assign = $row; // assign $row to $assign if(!isset($assign['clanname'])) // check the $assign array for an index called 'clanname' - you DID assign this in the line above Link to comment https://forums.phpfreaks.com/topic/193107-array-var-not-passing-itself-on/#findComment-1016963 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.