Re: Microsoft Access prepared statement with parameters problem

From: Date: Sat, 03 Mar 2001 15:51:12 +0000
Subject: Re: Microsoft Access prepared statement with parameters problem
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-5805@lists.php.net to get a copy of this message
Some possibilities: > $statement = odbc_prepare( $connection, "select * from System where A=?" ); Probably you would be better off using single quotes in the condition, since you are tryng to match strings, like: $statement=odbc_prepare($connection,"select * from System where A='?'"); here-^ ^ Also, I'm not sure that wildcards are allowed for string matching unless you use "like": $statement = odbc_prepare( $connection, "select * from System where A like '?'" ); Inside access, wildcards are * and ?, but when invoked through ODBC, * turns to %, and I think ? turns to _, but I'm not sure. Try the manual on that. And last, to eliminate possibilities, enclose any table or field names that might by far chance be a reserved word, in sqare brackets. I don't think that "A" is a reserved word, and am not sure about "System", but just to make sure... and end your statement with a semicolon. The final result would be: $statement = odbc_prepare( $connection, "select * from [System] where [A] like '?';" ); That, for syntax. But going further, "?" (or "_") is the single character matching wildcard. Why would your comparison use only a single character? If "A" is a single char field, use "like '%'", it would be safer and probably faster. But, there might be the chance that you're NOT trying to do a wildcard comparison, but are trying to search for the literal "?". Then you would use your actual syntax, but adding a backslash to escape the special char: "[A]='\?'". Some wild shots... hope it works. Gonzalo.

« previous php.windows (#5805) next »