Hi All , I need small help regarding functions.I wrote a code for retrieving values from database using functions.We are having nearly 20 functions in our application.But when I called each function,I have given connection details as a parameter or mentioned in the each function .So that loading time of the page is so long i.e. the page is displaying nearly 5-6 minutes.But I have to display the page with 5-6 secs. Here is sample application what i was written Samplefun.php: <?php $db->connect("localhost","root","","vijaya"); include('Functions.php'); $url="www.sciencedaily.com"; $rating=Getrating($url); echo $rating; echo"<br/>"; $assignedval=GetAssignedvalue($url,$rating); echo $assignedval; ?> Functions.php: <?php function Getrating($url) { $db = new mysqli(); $db->connect("localhost","root","vijaya","vijaya"); $stmt=$db->prepare( "call rating('$url')") ; // mysqli_stmt_bind_param($stmt, "s", $url); mysqli_stmt_execute($stmt); $result=$stmt->bind_result($rating); mysqli_stmt_fetch($stmt); $stmt->close(); return $rating; } function GetAssignedvalue($url,$rating) { $stmt1=$db->prepare( "call Get_Assigned_value('$url',$rating)") ; //mysqli_stmt_bind_param($stmt1, "sd", $url,$district); // mysqli_stmt_bind_param($stmt1, "d", $district); mysqli_stmt_execute($stmt1); $result=$stmt1->bind_result($values); mysqli_stmt_bind_result($stmt1, $values); mysqli_stmt_fetch($stmt1); //echo"<br/>"; //echo $values; $stmt1->close(); return $values; } ?> IF we wrote code like above we got following exeception: [Wed Dec 26 14:09:45 2007] [error] [client 127.0.0.1] PHP Notice: Undefined variable: db in F:\\Softwares\\php\\htdocs\\samples\\function_26.php on line 5 [Wed Dec 26 14:09:45 2007] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function connect() on a non-object in F:\\Softwares\\php\\htdocs\\samples\\function_26.php on line 5 [Wed Dec 26 14:13:51 2007] [error] [client 127.0.0.1] PHP Notice: Undefined variable: db in F:\\Softwares\\php\\htdocs\\samples\\function_26.php on line 21 [Wed Dec 26 14:13:51 2007] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function prepare() on a non-object in F:\\Softwares\\php\\htdocs\\samples\\function_26.php on line 21 Please help us regarding error problem --------------------------------- Why delete messages? Unlimited storage is just a click away. [Non-text portions of this message have been removed]