Bug #18172 Updated: Mysql_query function RLIKE and REGEXP

From: Date: Fri, 05 Jul 2002 17:49:50 +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-13243@lists.php.net to get a copy of this message
ID: 18172 Updated by: sander@php.net Reported By: r.denis@bell.ca -Status: Feedback +Status: Bogus Bug Type: MySQL related Operating System: Freebsd/Linux PHP Version: 4.2.1 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2002-07-05 13:22:19] r.denis@bell.ca $query2="select * from report WHERE users REGEXP 'robert.denis'"; $query2="select * from report WHERE users RLIKE '%robert.denis'"; $query2="select * from report WHERE users RLIKE '%robert.denis%'"; Does not return everything containing "robert.denis" //or $zcntlogin 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Jan 28 14:31:56 GMT 2002 murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC i386 ------------------------------------------------------------------------ [2002-07-05 13:12:53] sniper@php.net Make a SHORT example where you don't use any variables but the exact same SQL line you tried with the mysql shell. ------------------------------------------------------------------------ [2002-07-05 11:49:19] r.denis@bell.ca Here is a snippit of the actual code; ----------------------------------------------- <?php if (!isset($PHP_AUTH_USER) || !zcntlogin) { header("WWW-Authenticate: Basic realm=\"Bell Domain\""); header("HTTP/1.0 401 Unauthorized"); exit; } else { $zcntlogin =$PHP_AUTH_USER; //echo $zcntlogin; } ?> <?php if ($zcntlogin) { $id = "true"; $db = mysql_connect("localhost", "foo")or exit("Could not connect"); $db1 = mysql_select_db("report",$db); ?> <FORM> <TABLE WIDTH=800> <TR> <TD ALIGN="CENTER" COLSPAN=8><FONT SIZE=+2><B>Report Summary</B></FONT></TD> </TR> </TABLE> <?php $query2="select * from report WHERE users REGEXP '$zcntlogin'"; echo $query2; $result2 = mysql_query($query2) or die(mysql_error()); for ($i = 0; $i < mysql_num_fields($result2); $i++) { ?> <?php if (($myrow2)){ $myrow2["file1"] = preg_replace("/\s/", "%20" , $myrow2["file1"]); $records+=1; ?> <TABLE> <TR> <TD COLSPAN=4><sb><sb> <?php echo ($myrow2["file1"]) ? $myrow2["file1"] :"" ; ?><sb> <A HREF="../uploads/<?php echo $myrow2["file1"]; ?>">[expand]</A></TD> </TR> </TABLE> <?php } ?> <?php $myrow2=mysql_fetch_array($result2); } ?> <TABLE> <TD COLSPAN=4>Total Number of Records:<sb><sb> <?php echo $records ; ?><sb> <TR> <TD COLSPAN=128><HR></TD> </TR> </TABLE> <?php mysql_close($db); } ?> ------------------------------------------------------ ------------------------------------------------------------------------ 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

« previous php.bugs (#13243) next »