possible bug in PHP function mysql_query() ?

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 '%&...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-27-2003
Peter Walter
 
Posts: n/a
Default possible bug in PHP function mysql_query() ?

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
Reply With Quote
  #2 (permalink)  
Old 12-29-2003
Calico Jack
 
Posts: n/a
Default Re: possible bug in PHP function mysql_query() ?

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-

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:13 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0