unable to connect to MYSQL via PHP

Reply

Join Date: Dec 2008
Posts: 13
Reputation: nmakkena is an unknown quantity at this point 
Solved Threads: 0
nmakkena nmakkena is offline Offline
Newbie Poster

unable to connect to MYSQL via PHP

 
0
  #1
Mar 17th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 83
Reputation: ahmksssv is an unknown quantity at this point 
Solved Threads: 7
ahmksssv ahmksssv is offline Offline
Junior Poster in Training

Re: unable to connect to MYSQL via PHP

 
0
  #2
Mar 17th, 2009
Originally Posted by nmakkena View 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
hi..
check the database name is there or not?
Can u send ur code...
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 13
Reputation: nmakkena is an unknown quantity at this point 
Solved Threads: 0
nmakkena nmakkena is offline Offline
Newbie Poster

Re: unable to connect to MYSQL via PHP

 
0
  #3
Mar 17th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,749
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 331
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: unable to connect to MYSQL via PHP

 
0
  #4
Mar 17th, 2009
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.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC