* Matthew Stuart
[...]
> SELECT *
> FROM tbl_allarticles
> WHERE fld_headline OR fld_summary OR fld_body LIKE '%userinput%' AND
> fld_show = 1
This statement does not do what you probably intended it to... the above is
similar to this:
WHERE
fld_headline+0 != 0 OR
fld_summary+0 != 0 OR
fld_body LIKE '%userinput%' AND
fld_show = 1
When a character column is used as part of a logical expression, mysql try
to cast it to an integer, and use the integer value for the logical
operation. If the character value starts in a digit 1-9, optionally with a
"-" in front of it, the logical value of the string is true, otherwise it is
false.
You probably wanted this:
WHERE (
fld_headline LIKE '%userinput%' OR
fld_summary LIKE '%userinput%' OR
fld_body LIKE '%userinput%') AND
fld_show = 1
[...]
> I suspect it is something to do with KEY, I created the table with
> MySQL-Front and expected it to create INDEX's, but it has created KEY,
> something I have never come across before.
'KEY' is a synonym for 'INDEX' in mysql.
--
Roger