colleyboy Posted June 29, 2012 Share Posted June 29, 2012 Hi I am having trouble getting the parser to parse this statement: if (($row['liked_user_id']==$user_id)&&($row['user_id']==$the_user_id)){ echo "<FONT SIZE=1 COLOR=BLUE>You Like This Artist"; } It spits out: Parse error: syntax error, unexpected T_ELSE in /home/wormste1/public_html/tilburywebdesign/shop/FTPServers/boomchoon/pages/profileabout.php on line 84 I am trying to combine two clauses where the "liked_user_id" row is equal to the variable "$user_id" AND the row "user_id" equals the variable "$the_user_id". Many Thanks! Link to comment https://forums.phpfreaks.com/topic/265009-help-with-simple-if-statement-and-the-use-of-and/ Share on other sites More sharing options...
Barand Posted June 29, 2012 Share Posted June 29, 2012 It is very difficult to say what is wrong with an "else" statement when there isn't one in the code Link to comment https://forums.phpfreaks.com/topic/265009-help-with-simple-if-statement-and-the-use-of-and/#findComment-1358004 Share on other sites More sharing options...
colleyboy Posted June 29, 2012 Author Share Posted June 29, 2012 I forgot an } lol! I have another problem though: $aretheyliked = mysql_query("SELECT * FROM boom_likes WHERE user_id=$the_user_id"); while($row = mysql_fetch_array($aretheyliked)) It turns around and says "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/wormste1/public_html/tilburywebdesign/shop/FTPServers/boomchoon/pages/profileabout.php on line 73 " Line 73 is: while($row = mysql_fetch_array($aretheyliked)) Dont get it :S Link to comment https://forums.phpfreaks.com/topic/265009-help-with-simple-if-statement-and-the-use-of-and/#findComment-1358005 Share on other sites More sharing options...
scootstah Posted June 29, 2012 Share Posted June 29, 2012 That means the query failed and returned FALSE instead of a resource. You will need to display the query error with something like: $query = "SELECT * FROM boom_likes WHERE user_id=$the_user_id"; $result = mysql_query($query) or die("Query failed!<br />Query: $query<br />Error: " . mysql_error()); On a side note - if $the_user_id is not an integer it needs to be wrapped in quotes. WHERE user_id='$the_user_id' Link to comment https://forums.phpfreaks.com/topic/265009-help-with-simple-if-statement-and-the-use-of-and/#findComment-1358022 Share on other sites More sharing options...
colleyboy Posted June 29, 2012 Author Share Posted June 29, 2012 No problem... fixed it now Thanks ! Link to comment https://forums.phpfreaks.com/topic/265009-help-with-simple-if-statement-and-the-use-of-and/#findComment-1358024 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.