Jump to content

[SOLVED] MySQL Boolean Logic - Ultra Newbie


Recommended Posts

Trying to query the following table:

 

CREATE TABLE `gigs` (
  `id` int(6) NOT NULL auto_increment,
  `postdate` int(30) NOT NULL default '0',
  `gigdate` bigint(20) NOT NULL,
  `location` text NOT NULL,
  `price` varchar(20) NOT NULL,
  `deleted` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `postdate` (`postdate`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

 

with the following query:

 

SELECT * FROM gigs WHERE deleted=0 AND id>-1 AND (id=(1 OR 1 OR 1 OR 6 OR 6 OR 6 OR 6 OR 6 OR 6 OR 2 OR 2)) ORDER BY gigdate 

 

and it's only returning the first result it finds when it should return three results: those with unique IDs 1,2, and 6.  What's going on?

 

Cheers,

 

Anthony

Link to comment
https://forums.phpfreaks.com/topic/86000-solved-mysql-boolean-logic-ultra-newbie/
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.