Jump to content

is statements in query


ohdang888

Recommended Posts

$mb = mysql_query("SELECT * FROM `message_board`,`message_read` WHERE message_board.per_code='$rep_p' AND

(message_board.state='$rep_state'

OR message_board.state='ALL') AND ( if(message_read.u_id ='$user')!= `message_read.m_id` != `message_board.id`) ")or die(mysql_error());

 

this part is my trouble... AND ( if(message_read.u_id ='$user')!= `message_read.m_id` != `message_board.id`) ")or die(mysql_error());

 

the way the message board is set up, is that once a user reads it, they click "mark as read" and message_read gets a new row of the user id and the message id... so if they have marked it as read, do not display... thats what i want to acheive here

 

AND ( if(message_read.u_id ='$user') then `message_read.m_id` != `message_board.id`) ")or die(mysql_error());

if there is a row insert with their user id, then the message is cannot equal the messsage id that they qualify for, up until that little piece of the code...

 

 

Thanks.

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.