Jump to content

Help with simple if statement and the use of && (AND)


colleyboy

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.