You are here: query help AND OR « PHP SQL « IT news, forums, messages
query help AND OR

Posted by Rob on 04/23/07 14:24

Hello,

When i use the following query:

$sql = "SELECT * FROM table WHERE 1 AND project like '%$zoek%' and publi
NOT like 'no' order by jaar DESC LIMIT 0, 100";

I get what i want: all projects named '%$zoek%' where publi is not like
no.

However, when i want that '%$zoek%' is not only to be searched for in
project but also in locatie I use the next query:

$sql = "SELECT * FROM table WHERE 1 AND project like '%$zoek%' OR
locatie like '%$zoek%' and publi NOT like 'no' order by jaar DESC LIMIT
0, 100";

This does not do the thing I want:
records where publi is no are shown where I want them to be hidden.

Where do things go wrong?

Rob

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация