|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-07-04 23:08 UTC] r dot denis at bell dot ca
I am not certain what the issue is however,
When mysql_query is called in the following manner it fails
to return all regexp occurances of the the given variable;
Both REGEXP and RLIKE fail!
$query2="select * from report WHERE users REGEXP '$zcntlogin'";
//$query2="select * from report WHERE users RLIKE '$zcntlogin'";
This is, or from my understanding should be the equivalent of connecting to the
mysql server and executing the command:
select * from report WHERE users RLIKE 'firstname.lastname'; //which works!
In my script $zcntlogin is set through pam_smbd and mod_auth_external
<?php
if (!isset($PHP_AUTH_USER) || !zcntlogin) {
header("WWW-Authenticate: Basic realm=\"Bell Domain\"");
header("HTTP/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel button\n";
exit;
} else {
$zcntlogin =$PHP_AUTH_USER;
}
?>
Hopefully that helps.
Cheers,
Rob
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Jan 28 22:00:01 2026 UTC |
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); } ?> ------------------------------------------------------Sniper, I appreciate everyones help. I turns out that after carefully debugging /usr/local/libexec/apache/libphp4.so the regexp portion does not contain internal calls. It was indeed a small glitch in my code. the following line: //for ($i = 0; $i < mysql_num_fields($result2); $i++) { should have read: for ($i = 0; $i <= mysql_num_rows($result2); $i++ ) { OOPS! Because of the many facilities that php provides such as magic_quotes_* The use of additional functions such as pregquote is not required. I am shocked that nobody picked on the fact that some of the data was returned but not all of the data. The number of fields used in the database is 4 the number of records is the number of rows. Have a great day