Any ideas would help, I was on this for a while and just can not understand what is wrong.
Problem: the query works fine until I add a few words to the search, which you can see in bold below. However, I repeated the sql query and then inserted it into phpmyadmin and it worked fine, but through php it outputs 0 records. This makes no sense, and I cannot figure out what the result 0 might cause.
SELECT DISTINCT c.id FROM carpets AS c INNER JOIN carpet_relations AS r1 ON c.id = r1.carpet_id INNER JOIN carpet_relations AS r2 ON c.id = r2.carpet_id INNER JOIN carpet_relations AS r3 ON c.id = r3.carpet_id WHERE c.active = '1' AND ((c.title LIKE '%north tabriz%') OR **(c.title LIKE '%north%') OR (c.title LIKE '%tabriz%')** OR (c.item_no LIKE '%north tabriz%') OR **(c.item_no LIKE '%north%') OR (c.item_no LIKE '%tabriz%')** OR (c.pattern LIKE '%north tabriz%') OR **(c.pattern LIKE '%north%') OR (c.pattern LIKE '%tabriz%')** OR (c.period LIKE '%north tabriz%') OR **(c.period LIKE '%north%') OR (c.period LIKE '%tabriz%')** OR (c.country LIKE '%north tabriz%') **OR (c.country LIKE '%north%') OR (c.country LIKE '%tabriz%')**) AND (c.width_feet BETWEEN '0' AND '22') AND (c.width_inches BETWEEN '0' AND '11') AND (c.height_feet BETWEEN '0' AND '49') AND (c.height_inches BETWEEN '0' AND '11') ORDER BY c.item_no id int(11) NO PRI NULL auto_increment active int(11) NO NULL title varchar(250) NO NULL item_no varchar(250) NO NULL country varchar(250) NO NULL period varchar(250) NO NULL pattern varchar(250) NO NULL price float NO NULL web_special float NO NULL notes text NO NULL width_feet int(11) NO NULL width_inches int(11) NO NULL height_feet int(11) NO NULL height_inches int(11) NO NULL restrict int(11) NO NULL views_amount int(11) NO NULL last_modified datetime NO NULL modified_by int(11) NO NULL
php mysql phpmyadmin
Nate imus
source share