Skipjackrick Posted January 22, 2010 Share Posted January 22, 2010 Is there something wrong here? I can't figure this out. Looks perfectly normal to me? <?php if ( $results['team_id'] == 0 ) { $team .= 'Not Specified'; } else { $queryteam = "SELECT * FROM team WHERE team_id={$results['team_id']} "; $result = mysql_query($queryteam) or die(mysql_error()); $team = mysql_fetch_assoc($result) } ?> Link to comment https://forums.phpfreaks.com/topic/189462-if-statement-syntax/ Share on other sites More sharing options...
iPixel Posted January 22, 2010 Share Posted January 22, 2010 This part is iffy $team .= 'Not Specified'; You're appending values to the $team variable by using .= but in the else statement you are not. Which leads me to believe you need $team = ""; somewhere above that code. Do You? Link to comment https://forums.phpfreaks.com/topic/189462-if-statement-syntax/#findComment-1000061 Share on other sites More sharing options...
Skipjackrick Posted January 22, 2010 Author Share Posted January 22, 2010 This part is iffy $team .= 'Not Specified'; You're appending values to the $team variable by using .= but in the else statement you are not. Which leads me to believe you need $team = ""; somewhere above that code. Do You? No, I am not using that above.... I see what you mean. Link to comment https://forums.phpfreaks.com/topic/189462-if-statement-syntax/#findComment-1000065 Share on other sites More sharing options...
Skipjackrick Posted January 22, 2010 Author Share Posted January 22, 2010 Here is my output when the if statement is true echo "$team"; is displayed like this N Link to comment https://forums.phpfreaks.com/topic/189462-if-statement-syntax/#findComment-1000066 Share on other sites More sharing options...
Skipjackrick Posted January 22, 2010 Author Share Posted January 22, 2010 Dang, I found it...too quick to post..... However, I am thankful that you noticed my appending variable.. I didn't mean to do that. The answer.... I was missing a semicolon below..... $team = mysql_fetch_assoc($result) Link to comment https://forums.phpfreaks.com/topic/189462-if-statement-syntax/#findComment-1000074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.