Saturday, July 10, 2010

How to format SQL query to get LIKE %something%

I use Pamela example (Thank you, Pamela) with phpsqlsearch_genxml.php
and wish to add % on the begining and end of string that I get using
URL.

phpsqlsearch_genxml.php?lat=54.5259614&lng=15.2551187&club=Fets

my phpsqlsearch_genxml.php is

SELECT Address, Club, PostCode, City, Country, WebAddress FROM clubs
WHERE Club LIKE '$clubname' "

I try lot of combination included CONCATE and can't get result.

CONCATE query direct to database give what I need but parsing thru XML
it's nightmare for me in this moment.

Can somebody have any idea or solution. Point is to get something
like

$query = 'SELECT Address, Club, PostCode, City, Country, WebAddress
FROM clubs WHERE Club LIKE %"$clubname"% '

but I do not know how to do that.

I try

$query ='SELECT Address, Club, PostCode, City, Country, WebAddress
FROM clubs WHERE Club LIKE CONCATE("%","$clubname","%") '

and not work.

--
You received this message because you are subscribed to the Google Groups "Google Maps API" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate