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? 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. 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) { 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 ; 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 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 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. 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 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
Archived
This topic is now archived and is closed to further replies.