Only variables can be passed by reference - Preg_match Fatal error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi 

When i try to compile this code it gives following error.....
<b>Fatal error</b>:  Only variables can be passed by reference in <b>/var/www/html/hello/test.php</b> on line <b>16</b><br />

I have defined variable for to match some string patterns / symbols.
when i execute that code for   preg_match , gives this fatal error .

<?php

$user="root";
$pass="pass";
$db="database";
$pattern="[ _  :< ] >";
       
         $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 ServiceNo,Reply from Acknowledgement order by ServiceNo") 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("$pattern","/$chk_msg/","$msg", $match) ) {
                        // match found
                        $SQL="update ServiceStatus set Status = 'UP' where ServiceNo=".$rset["ServiceNo"];
                        mysql_query ("$SQL") or die ("Invalid 2nd query");
                }else{
                        
                }

        }
        mysql_close($dblink);

?>

how can i prevent this problem ???


Thanx in advance
chandana

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux