Hi Mark,

2003年 7月 27日 日曜日 06:09、Obantec Support さんは書きました:
> Hi
>
> I have a database supplied to me that was excel but now uploaded to mysql.
> (the data is out of my hands.)
>
> i need to search for 1 of 2 categories against 3 fields with user inputted
> data.
>
> example Categories=Lessor , searchtype = BusinessCity searchdata = (user
> input)
>
> $sql = "SELECT * FROM Contacts WHERE Categories=\"$calltype\" and
> $searchtype LIKE \"$searchdata%\"";
>
> there are 2 Categories supplied via 2 different pages which load the same
> form and use call to determine Category.
>
> $searchtype is 1 of 3 text boxes against which searchdata is passed.
>
> I need to get all columns hence the * but need $searchdata to try and match
> all of text in the $searchtype column.
>
> using the LIKE \"$searchdata%\" gets me only from start of test i.e. Fin
> will find Financial from "Financial Text Widgets"
> but not Financial from "Widgets Text Finance"

 How about LIKE \"$%searchdata%\" ?

I am not sure if you really need the $ there. If it is for php than it might 
be o.k there, but for MySQL I believe you don't need it in your case (if 
understood correctly what you want to do ;-)

So please try also this :

LIKE '%searchdata%'


Best regards

Nils Valentin
Tokyo/Japan

>
> using php as my chosen language.
>
> Mark

-- 
---
Valentin Nils
Internet Technology

 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp
 Personal URL: http://www.knowd.co.jp/staff/nils


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to