在mysqli_connect之后停止执行('','','')

i have wriiten a a code in php...

<?php
 echo "entering db php code";
 $link=mysqli_connect ('localhost','root','MyRootPassword');
 echo "mysqli_connect is called";
 if (!$link)
 {
     echo "cannection is failed";
     exit();    
 }
 echo "connection is ok";
 ?>

output is::

entering db php code

that's it.*the code stop executing after mysqli_connect() call.* can anyone please tell me that.what is the problem in the code. this code is absolutely doing nothing with the mysqli_connect() call and it stop executing the rest part once mysqli_connect is called

You should enable error displaying like:

ini_set('display_errors',1);
error_reporting(E_ALL | E_STRICT);

But if you never get to the second echo, that probably means that the mysqli extension is not installed and you get an undefined function error, stopping your script.

Does phpinfo(); give you a section with mysqli information?

$link=mysqli_connect ('localhost','root','MyRootPassword');

is missing an argument.

The correct way to call mysqli_connect is

$link = mysqli_connect('server', 'username', 'password', 'database_name');

Alternatively, you can define the following in your php.ini file

mysqli.default_host
mysqli.default_user
mysqli.default_pw
mysqli.default_db
mysqli.default_port //You should only need to change this rarely
mysqli.default_socket //You should only need to change this rarely

And call the mysqli_connect as

$link = mysqli_connect();

i have solved it :D :) earlier i have installed php installer version.i uninstalled it.and then unzip the php 5.2.x thread safe.now it's working after the necessary configuration ...