This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2004 > Search with 2 searchfields in mySQL DB





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Search with 2 searchfields in mySQL DB
Freebeeezz

2004-08-26, 12:20 pm

Hi,

I have page in PHP made with DW-MX and the Phakt2 extension.
I want to search in a database and if neccesery use a second search-word
I've got two search fields on the first page, when one search field is
filled in the results are ALL the field of the database, when I fill in the
first and the second seachfield the results are Ok.

What do I wrong, why does the results returns ALL the fields from the Table
when only one searchfield is filled in, how can I fix this and still using
the second search-field if I want.

Here is the SQL I use:
SELECT Id, Gironummer, Datum, Soort, Code1, Tegennummer, Begunstigde,
Bedrag, E_of_FL, Omschrijving_1, Omschrijving_2, Omschrijving_3,
Omschrijving_4
FROM GIRO
WHERE (Datum LIKE '%colname%' OR Begunstigde LIKE '%colname%' OR
Omschrijving_1 LIKE '%colname%' OR Datum LIKE '%zoek2%' OR Begunstigde LIKE
'%zoek2%' OR Omschrijving_1 LIKE '%zoek2%') AND Gironummer = level

The Variables are:
Name Default Value Run-time Value
zoek2 -1 $HTTP_POST_VARS['zoek2']
level -1 $HTTP_POST_VARS['KT_useAuth']
colname -1 $HTTP_POST_VARS['zoek']

Thanks fo your help.

Freebeeezzz


Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews