Jump to content

Could not connect to MYSQL


devdas_kamath

Recommended Posts

I have installed mysql and php5 in my machine. mysql server is running. Apache is also running. normal page displayed correctly with following code.

<html>

<head>

"Heading"

</head>

<body>

<?php

  echo "Hi this php";

 

  $dbcnx = @mysql_connect('localhost', 'root', 'winman') or die("d");

  mysql_select_db("winmannodb") or die("<b>could not select database</b>.");

?>

</body>

</html>

 

 

the word 'hi this is php' comes in the browser but no message for mysql connection even if database is given wrong which is not there in the mysql server. pls advice.

 

thanking u

Link to comment
https://forums.phpfreaks.com/topic/78356-could-not-connect-to-mysql/
Share on other sites

Try like this, your echo will run cause it has nothing to do with mysql connection

<?php
error_reporting(E_ALL);
echo "Hi this php";

  $dbcnx = mysql_connect('localhost', 'root', 'winman') or die("d");
  mysql_select_db("winmannodb") or die("could not select database.");
?>
<html>
<head>
"Heading"
</head>
<body>
</body>
</html>

 

In php.ini see if this line is uncommented

extension=php_mysql.dll

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.