Current location: Hot Scripts Forums » Programming Languages » PHP » mysql connect


mysql connect

Reply
  #1 (permalink)  
Old 12-27-06, 10:04 AM
php_beginner php_beginner is offline
New Member
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
mysql connect

I'm sorry, maybe my question is stupid ....

I have installed mysql on my PC and I have created following php file:


<?php

mysql_Connect('localhost', 'root', '') or die('Connection error');

?>

If I open this script in browser, it will show me "Connection error"
username and password are correct .....
Reply With Quote
  #2 (permalink)  
Old 12-27-06, 10:21 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
I recommend changing your die(...) statement to include the mysql_error() function to get the maximum error reporting -
PHP Code:

mysql_Connect('localhost''root''') or die('Connection error' mysql_error()); 

__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #3 (permalink)  
Old 12-27-06, 10:30 AM
php_beginner php_beginner is offline
New Member
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Ahh thanks. I found that mysql process was stopped ...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can't connect to MySQL all of a sudden, PHP My Admin still works nassau PHP 6 03-10-06 01:24 PM
Connect to MySQL and create variables ronlar ASP.NET 2 08-19-05 11:34 AM
PHP scripts unable to connect to DB after MySQL 4.1.10 upgrade Jason L PHP 3 03-08-05 12:32 AM
Can't connect to mysql in include file when included in forums Forse PHP 2 07-12-04 07:39 PM
Error while creating database (Errornumber 2002: "Can't connect to local MySQL server lylesback2 PHP 5 04-11-04 01:37 PM


All times are GMT -5. The time now is 05:51 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.