possible bug in PHP function mysql_query() ?
| From: | Peter Walter | Date: | Sat, 27 Dec 2003 02:17:46 +0000 |
| Subject: | possible bug in PHP function mysql_query() ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173351@lists.php.net to get a copy of this message | ||
MySQL version: 4.0.16
PHP version: 4.3.2
Problem code:
$query = "SELECT * FROM tablename
WHERE columnname LIKE '%<any_eight_digits>%'";
mysql_query($query);
Results:
query fails, mysql_errno() returns 1064 (syntax error)
I have tracked the problem down to the WHERE clause; using any other number of digits (except eight), the query suceeds. It seems to be a problem with the comparison logic, because other comparison operators also fail; specifically, I have tested
WHERE columnname = <any_eight_digits>
and
WHERE columnname = '<any_eight_digits>'
When running the identical query in PhpMyAdmin 2.5.5 RC1, or at the MySQL command line, the query works without a problem.
I am a PHP/MySQL newbie. Before I rush off and report this as a PHP bug, can anyone else confirm this behavior, or explain what I am doing wrong?
Peter