I'm not sure what you're trying to do with preg_match, since the
parameters you send to it, are from the database, and an  undeclared
variable $msg(which is what exactly). Unless you give us examples of
the arguments to preg_match, and what you expect the results should
be, as well as what they are, we can't really be of much help.

Having that said:
You are using "/$chk_msg/" as the first  parameter. since you are
simply putting /'s around $chk_msg, this leads me to suggest that you
don't need regex at all, and perhaps would be better using some of the
string functions. strpos() ( http://www.php.net/strpos ) springs to
mind.

Just a few tips:
As an aside, I notice that you are connecting to localhost:3306. Just
incase you didn't know, when you connect to localhost through
mysql_connect, assuming you are on a unix host, it uses a unix socket,
regardless if  you specify a port. If you want to override this
behavour, and use TCP sockets, you can connect to 127.0.0.1.


On Sat, 8 Jan 2005 00:37:34 +0600, Chandana Bandara
<[EMAIL PROTECTED]> wrote:
> This php script perform matching text of some certain URLs. but in this 
> preg_match it wont match few patterns <  _ .
> with help of this script , can some body help me to match the other all 
> patterns .............plz ?
> 
> <?php
> 
> $user="root";
> $pass="****";
> $db="aa";
>         $dblink = mysql_connect("localhost:3306", "$user", "$pass")or 
> die("Could not connect to db");
>         mysql_select_db($db) or die ("can't select the db");
> 
>         $result = mysql_query ("select indexNo,Reply from Acknowledgement 
> order by indexNo") or die ("Invalid query");
>         while ( $rset= mysql_fetch_array($result)) {
>                 /* Lets check the reply with the database*/
>                 $chk_msg= $rset["Reply"];
>                 //echo "checking $chk_msg in $msg<br>";
>                 if ( preg_match("/$chk_msg/", "$msg", $match) ) {
>                         // match found
>                         $SQL="update Status set Status = 'UP' where 
> ServiceNo=".$rset["ServiceNo"];
>                         mysql_query ("$SQL") or die ("Invalid 2nd query");
>                 }else{
>                         // SERIVCE DOWN
>                         // nothing to do here.
>                         //echo "No match..<br>";
>                 }
> 
>         }
>         mysql_close($dblink);
> 
> ?>
> 
> thanx in advance,
> chandana
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to