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
https://forums.phpfreaks.com/topic/113352-is-statements-in-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.