943,674 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 598
  • PHP RSS
Mar 17th, 2009
0

unable to connect to MYSQL via PHP

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nmakkena is offline Offline
14 posts
since Dec 2008
Mar 17th, 2009
0

Re: unable to connect to MYSQL via PHP

Click to Expand / Collapse  Quote originally posted by nmakkena ...
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...
Reputation Points: 11
Solved Threads: 7
Junior Poster in Training
ahmksssv is offline Offline
84 posts
since Feb 2009
Mar 17th, 2009
0

Re: unable to connect to MYSQL via PHP

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nmakkena is offline Offline
14 posts
since Dec 2008
Mar 17th, 2009
0

Re: unable to connect to MYSQL via PHP

Try or die(mysql_error()); instead of your custom message. This will let you know what exactly is the error.
Last edited by nav33n; Mar 17th, 2009 at 6:02 am.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Copy text between "start" and "end"
Next Thread in PHP Forum Timeline: Order by name





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC