You should be able to just use something like this:

Select uid, username From tablename Where '$externalstringvar' like query;

That's PHP syntax.  You'll have to use whatever makes sense for your
scripting or programming language in place of the $externalstringvar
variable.  The single-quotes are required.

Note this will always do a full table scan, so if your table is big, it will
be slow.

..chris

----- Original Message -----
From: "thor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 23, 2002 4:22 AM
Subject: Help needed on query


I have a table like this one:

+-----+-----------+-------+
| uid | username  | query |
+-----+-----------+-------+
|   1 | someuser  | %qu1% |
|   2 | anotheru  | bla%  |
+-----+-----------+-------+

I get a string from external source, let's say the string is 'blahblah'.

Now I need a query which will take the values from column 'query', treat
them
as patterns for matching and return row(s) which match the given string
'blahblah'. In this example, the matched data is obviously in second row.
(bla% matches blahblah)

Do I make any sense? Is this possible?
Any help will be greatly appreciated.





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to