PhpxZ Posted July 2, 2010 Share Posted July 2, 2010 if($row['sex'] == 1){ but i get this error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in what is whe problem? Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/ Share on other sites More sharing options...
trq Posted July 2, 2010 Share Posted July 2, 2010 Nothing wrong with the code you have shown, its likely before that piece. Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/#findComment-1080088 Share on other sites More sharing options...
PhpxZ Posted July 2, 2010 Author Share Posted July 2, 2010 Nothing wrong with the code you have shown, its likely before that piece. Here is the full code while ($row = mysql_fetch_array($result)) { if ($row['reason'] == NULL) { $count = true; echo '<div style="margin:5px;padding:15px;'; if ($bright) { echo 'background-color:#f4f3f0;border:1px solid #a0a0a0'; $bright = false; } else { echo 'background-color:#e5ecf9;border:1px solid #9da9bf'; $bright = true; } $accid = $row['accid']; $result2 = mysql_query('SELECT * FROM accounts WHERE id='. $accid .''); $row2 = mysql_fetch_array($result2); $accNAME = $row2['name']; if($row['submited'] != NULL){ $submited = $row['submited']; } else { $submited = "informacijos n?ra"; } $metai = date('Y') - $row['age']; echo '"> <p align="right">Date: '.$submited.'</p> <b>Character Name:</b> '. $row['charname'] .'<br /> if($row['sex'] == 1) { <b>Sex:</b> Male<br /> } else{ <b>Sex:</b> Female<br /> } <b>Age:</b> '. $row['age'] .' (' .$metai. ')<br /><br /> I get the error for the line if($row['sex'] == 1) { Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/#findComment-1080091 Share on other sites More sharing options...
trq Posted July 2, 2010 Share Posted July 2, 2010 The line before the one you posted is missing a closing ' and ; Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/#findComment-1080094 Share on other sites More sharing options...
kenrbnsn Posted July 2, 2010 Share Posted July 2, 2010 You can't have an if statement in the middle of an echo statement like that. You can do this: <?php echo '"> <p align="right">Date: '.$submited.'</p> <b>Character Name:</b> '. $row['charname'] .'<br /><b>Sex:</b> ' . (($row['sex'] == 1)?'Male':'Female') . '<br /><b>Age:</b> '; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/#findComment-1080095 Share on other sites More sharing options...
PhpxZ Posted July 2, 2010 Author Share Posted July 2, 2010 Parse error: syntax error, unexpected '<' in The line after the if Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/#findComment-1080097 Share on other sites More sharing options...
trq Posted July 2, 2010 Share Posted July 2, 2010 Read Ken's reply, I didn't even notice what your trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/#findComment-1080098 Share on other sites More sharing options...
PhpxZ Posted July 2, 2010 Author Share Posted July 2, 2010 I did something else.. Thanks you all Quote Link to comment https://forums.phpfreaks.com/topic/206478-syntax-error-unexpected-t_string/#findComment-1080099 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.