[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: SQL Search II
The docs say that in forms you use the ? place holder for form data.
I had a small problem with this in LIKE statements because I think its
expecting an equals or some other operator other then LIKE. when I did this
it removed all whitespaces and my SQL query would end up looking like this
SELECT * FROM Items WHERE ItemDescription LIKEtextentered
this of course is a SQL syntax error ;) so to get around it what I did is I
set up a simple Javascript function:
<SCRIPT Language="Javascript">
function assignit(frm,txtfield) {
frm.mv_searchspec.value = "SELECT * FROM Items WHERE ItemDescription
LIKE '%" + txtfield.value + "%'";
}
</SCRIPT>
my scripting skills leave a lot to be desired but this seems to do the trick
;) I can search Items matching against the ItemDescription field from any
form on my page, and thats what I needed ;)
You will need to use an array instead of just a single object for txt fields
then loop thru constructing your SQL query, but it shouldnt be too dificult
if you have a good Javascript book handy or are competent in Javascript.
Hope this helps
Brian Korsund
-----Original Message-----
From: Kim Armann <kim@nichols.de>
To: minivend-users@minivend.com <minivend-users@minivend.com>
Date: Monday, July 26, 1999 2:27 AM
Subject: SQL Search II
>****** message to minivend-users from Kim Armann <kim@nichols.de>
******
>
>Hi, I have a form with e.g. 3 textfield (name_1,name_2,name_3).
>I want to search :
>name_1 should be in field_1 or field_2 or fiel_3
>name_2 should be in field_4
>name_3 should be in field_5
>
>... what can I do, I use MySQL (Database products products.asc
>dbi:mysql:minivend:localhost:3333)
>SQL statements like select * from products where field_1 like name_1 or
>field_2 like name_1 ,.... make errors ... (see Mail SQL Search).
>
>thx, Kim Armann
>-
>To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
>email with 'UNSUBSCRIBE minivend-users' in the body to
Majordomo@minivend.com.
>Archive of past messages: http://www.minivend.com/minivend/minivend-list
>