RE: Need SQL Help for PHP_WIN and ODBC/Access

From: Date: Fri, 04 Oct 2002 03:42:13 +0000
Subject: RE: Need SQL Help for PHP_WIN and ODBC/Access
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-16155@lists.php.net to get a copy of this message
try "SELECT Files.Fileame, Products.ProdName FROM Products INNER JOIN Files ON Products.bid = Files.bid WHERE Products.ProdName LIKE ' * " . $ProdVar . " * ' " pls. remove spaces arnd * , i hv put them to make clearly visible single & double quotes. this may also work: "SELECT Files.Fileame, Products.ProdName FROM Products INNER JOIN Files ON Products.bid = Files.bid WHERE Products.ProdName LIKE '\"*" . $ProdVar . "*\"" regds, -----Original Message----- From: Williams, Dewey [mailto:williams@email.uncc.edu] Sent: Friday, October 04, 2002 02:29 To: php-windows@lists.php.net Subject: Need SQL Help for PHP_WIN and ODBC/Access HELP! I am trying to write an sql statement to get data from my Access database through ODBC. Everything works okay if I write a simple Select statement, but I need to write a statement like: "SELECT Files.Fileame, Products.ProdName FROM Products INNER JOIN Files ON Products.bid = Files.bid WHERE Products.ProdName LIKE *" . $ProdVar . "*"; I need the WHERE statement to use LIKE and wrap the variable $ProdVar in * so users can do a text search on the field. This is where things get nasty. I have tried every combination of * "" . LIKE etc and get no records returned or an Access ODBC driver error saying that there were "too few parameters. Expecting 1." If anyone has a clue on how to write this statement, what is wrong with the above, what can be fixed, changed, etc in php to make it work ... I would really appreciate a hand. Thanks Dewey Williams williams@email.uncc.edu

« previous php.windows (#16155) next »