herghost Posted September 26, 2009 Share Posted September 26, 2009 Hi all, Can someone tell me what I am doing wrong with this IF Else query? I am getting a parse error on this line: if ($rows['userlevel'] > 3) || ($rows['user_id'] == $_SESSION['user_id']) But I dont know what the problem is! Here is the piece of code in full <?php $sql99="SELECT userlevel FROM user_info WHERE user_id = '$user_id'"; $result=mysql_query($sql99); while($rows=mysql_fetch_array($result)) { if ($rows['userlevel'] > 3) || ($rows['user_id'] == $_SESSION['user_id']) { $sql2="SELECT * FROM forum_answer WHERE question_id='$id'"; $result2=mysql_query($sql2); while($rows=mysql_fetch_array($result2)) { ?> <table width="95%" border="0"> <hr> <h3>Reply Number<?php echo $rows['a_id'] ;?></h3> <tr> <th width="20%">Posted On: </th> <td><span style="color:#0F7"><?php echo $rows['a_datetime'] ;?></span></td> </tr> <tr> <th width="20%"><?php echo $rows['a_username'];?>'s Reply:</th> <td><span style="color:#00F"> <?php echo $rows['a_answer']; ?></span></td> </tr> </table> <?php } ?> <?php else { echo "Incorrect" ; } ?> Link to comment https://forums.phpfreaks.com/topic/175585-solved-if-else-help-not-having-much-luck-with-these/ Share on other sites More sharing options...
trq Posted September 26, 2009 Share Posted September 26, 2009 Sould be.... if ($rows['userlevel'] > 3 || $rows['user_id'] == $_SESSION['user_id']) or if (($rows['userlevel'] > 3) || ($rows['user_id'] == $_SESSION['user_id'])) Your entire if expression needs to be within ( ) Link to comment https://forums.phpfreaks.com/topic/175585-solved-if-else-help-not-having-much-luck-with-these/#findComment-925254 Share on other sites More sharing options...
herghost Posted September 26, 2009 Author Share Posted September 26, 2009 Thanks thorpe, Im getting there! Link to comment https://forums.phpfreaks.com/topic/175585-solved-if-else-help-not-having-much-luck-with-these/#findComment-925255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.