This is a discussion on possible bug in PHP function mysql_query() ? within the PHP General forums, part of the PHP Programming Forums category; MySQL version: 4.0.16 PHP version: 4.3.2 Problem code: $query = "SELECT * FROM tablename WHERE columnname LIKE '%&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
Peter Walter wrote:
> 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 Can you show us the exact query? I doubt this is a PHP or MySQL bug. It would be nice to see the actual query exactly as it would go to the mysql server. -Calico Jack- |
![]() |
| Thread Tools | |
| Display Modes | |
|
|