Bug #18172 Updated: Mysql_query function RLIKE and REGEXP
| From: | sniper@php.net | Date: | Fri, 05 Jul 2002 19:42:32 +0000 |
| Subject: | Bug #18172 Updated: Mysql_query function RLIKE and REGEXP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13262@lists.php.net to get a copy of this message | ||
ID: 18172
Updated by: sniper@php.net
Reported By: r.denis@bell.ca
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: Freebsd/Linux
PHP Version: 4.2.1
New Comment:
Try doing this:
$zcntlogin = preg_quote($zcntlogin);
From mysql manual:
"Note: Because MySQL uses the C escape syntax in strings (for example,
\n'), you must double any \' that you use in your REGEXP strings"
a dot '.' is special..so you have to escape it.
If this didn't help either, please provide a SHORT but complete example
script, max 5 lines, which does not work.
Previous Comments:
------------------------------------------------------------------------
[2002-07-05 14:57:20] r.denis@bell.ca
.
------------------------------------------------------------------------
[2002-07-05 14:34:32] r.denis@bell.ca
In order for you to understand. I am going to give you a more logical
approch.
The mysql server
-----------------------------------------
mysql> connect report
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Connection id: 2887
Current database: report
mysql> select * from report WHERE users REGEXP 'robert.denis';
+----+---------------------------------------+--------------+------------+---------------------------------------------+
| id | file1 | sysstartdate |
sysenddate | users |
+----+---------------------------------------+--------------+------------+---------------------------------------------+
| 1 | 20020629.jdbgmgrE.htm | 2002-06-29 |
2002-06-29 | hbpritch robert.denis |
| 2 | 20020629.jdbgmgrE.htm | 2002-06-29 |
2002-06-29 | hbpritch robert.denis |
| 3 | 20020702.What is CyberArmor Suite.doc | 2002-07-02 |
2002-07-02 | benoit.joubert robert.denis scott.beauchamp |
| 4 | 20020702.jdbgmgrE.htm | 2002-07-02 |
2002-07-02 | robert.denis nancy.kolassa |
| 5 | 20020702.2002esrq1e.doc | 2002-07-02 |
2002-07-02 | robert.denis melsegui |
| 6 | 20020702.putty.exe | 2002-07-02 |
2002-07-02 | robert.denis melsegui |
| 7 | 20020702.Rapport_5220111200 Theft.doc | 2002-07-02 |
2002-07-02 | robert.denis melsegui |
| 8 | 20020702.Maj-Eng logo elec final.dot | 2002-07-02 |
2002-07-02 | robert.denis melsegui |
| 9 | 20020703.meeting4_map.pdf | 2002-07-03 |
2002-07-03 | robert.denis robert.denis |
| 10 | 20020704.What is CyberArmor Suite.doc | 2002-07-04 |
2002-07-04 | robert.denis robert.denis |
| 11 | 20020704.What is CyberArmor Suite.doc | 2002-07-04 |
2002-07-04 | robert.denis robert.denis |
| 12 | 20020704. | 2002-07-04 |
2002-07-04 | robert.denis robert.denis |
| 13 | 20020704.jdbgmgrE.htm | 2002-07-04 |
2002-07-04 | robert.denis robert.denis |
| 14 | 20020704.jdbgmgrE.htm | 2002-07-04 |
2002-07-04 | robert.denis benoit.joubert |
| 15 | 20020704.jdbgmgrE.htm | 2002-07-04 |
2002-07-04 | robert.denis benoit.joubert |
| 16 | 20020704.jdbgmgrE.htm | 2002-07-04 |
2002-07-04 | robert.denis rdenis@ruoc4k.on.bell.ca |
+----+---------------------------------------+--------------+------------+---------------------------------------------+
16 rows in set (0.00 sec)
---------------------------------
The apache webserver
Server: Apache/1.3.26 (Unix) mod_ssl/2.8.10 OpenSSL/0.9.6a
mod_perl/1.26 PHP/4.2.1
The php webpage
--------------------
Report Summary
select * from report WHERE users REGEXP 'robert.denis'
20020629.jdbgmgrE.htm [expand]
20020629.jdbgmgrE.htm [expand]
20020702.What%20is%20CyberArmor%20Suite.doc [expand]
20020702.jdbgmgrE.htm [expand]
Total Number of Records: 4
------------------------------------------
Any ideas? There is nothing with the implimentation of the POSIX
regexp. The same sort of thing can be done in almost all scripting
languages.
--
Regards
Robert
------------------------------------------------------------------------
[2002-07-05 13:49:50] sander@php.net
Nevermind. You're just messing with the SQL syntax. Read MySQL's
manual, especially the part about "String comparison functions"
Not a bug in PHP.
------------------------------------------------------------------------
[2002-07-05 13:46:04] sander@php.net
What does mysql_error() say about this query? Just call echo
mysql_error() directly after the mysql_query() call.
------------------------------------------------------------------------
[2002-07-05 13:42:18] r.denis@bell.ca
# strings /usr/local/libexec/apache/libphp4.so | grep -i like
Call-time pass-by-reference has been deprecated - argument passed by
value; If you would like to pass it by reference, modify the
declaration of %s(). If you would like to enable call-time
pass-by-reference, you can set allow_call_time_pass_reference to true
in your INI file.
I tried for the fun of it to see whether or not the above had any
bearing....appears not.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/18172
--
Edit this bug report at http://bugs.php.net/?id=18172&edit=1