tags:

views:

42

answers:

3

I have installed php and mysql on windows xp with iis 5.1 as my web server. But when i run the following code it just shows me a blank page. Can anybody let me know where i am wrong. Thanks in advance.

<?php
$con = mysql_connect("localhost","root","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>
+2  A: 

Well, it doesn't generate any output if the connection succeeds so that's probably what's happening. What would you expect?

Raoul Duke
A: 
<?php
    $con = mysql_connect('localhost', 'root', 'xxxx') or die(mysql_error());
?>

what does this print ? * make sure you have mysql running * make sure you have php running on IIS * try to check in php.ini:

error_reporting = E_ALL
display_errors = On
Mihai Iorga
A: 

Use the following code


$con = mysql_connect("localhost","root","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
} else {
  die('Connection ok!');
}

vlad b.