Jump to content


Photo

OR function


  • Please log in to reply
1 reply to this topic

#1 mcmuney

mcmuney
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 28 September 2006 - 06:29 PM

When I add OR function to this query, it doesn't work, what am I doing wrong?

ORIGINAL
	$sel_image="select scm_mem_id,sci_url FROM sc_member_images WHERE sci_slogan<>'M' ORDER BY sci_id DESC";

WITH OR STATEMENT
	$sel_image="select scm_mem_id,sci_url FROM sc_member_images WHERE (sci_slogan<>'M' OR sci_slogan<>'D') ORDER BY sci_id DESC";


#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 28 September 2006 - 10:16 PM

I believe you really mean
WHERE (sci_slogan<>'M' AND sci_slogan<>'D')
or
WHERE sci_slogan NOT IN ('M', 'D')

NOT (M OR D) = NOT M AND NOT D
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users