My system is a stand alone system, I want to connect to MYSQL using PHP, I am giving hostname as localhost, and the needed username and passoword. In the browser i am getting Internal server error 500.


Any sort of help much appreciated,
Thank you

Recommended Answers

All 3 Replies

My system is a stand alone system, I want to connect to MYSQL using PHP, I am giving hostname as localhost, and the needed username and passoword. In the browser i am getting Internal server error 500.


Any sort of help much appreciated,
Thank you

hi..
check the database name is there or not?
Can u send ur code...

This is my code:
<?php
$username = "aaa";
$password = "aaa";
$hostname = "localhost";
$dbh=mysql_connect($hostname, $username, $password)
or
die("unable to connect to the datatabase");
print "connected to MYSQL<br>";
mysql_close($dbh);
?>
/*I am not giving any database name, initially i just want to connect to MySql database*/

Thank you

Try or die(mysql_error()); instead of your custom message. This will let you know what exactly is the error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.