i got this error msg in online... how to solve this
problem... i couldnot find out as soon as possible send me
answer or idea


COULD NOT ABLE TO CONNECT DATABASE .
Can't connect to local MySQL server through socket
'/usr/local/mysql-5.0/data/mysql.sock' (2)

Answer Posted / ritu

First you have to make a database connection. coding is below mention:
first u have to create a connection to server like:
mysql_connect("localhost","root","");

then select the database like:
mysql_select_db("database_name");

localhost is default server name.
root is default user name.
"" is default password. it means password is blank.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the content of /etc directory?

566


How can we submit form without a submit button?

559


How to Retrieve the Session ID of the Current Session?

535


What is the difference between for and foreach loop in php?

628


Who is the father of php and what is the current version of php and mysql?

691






What is php static function?

543


Is php easy language to learn?

577


Can constructor be private in php?

545


Which operator is used to concatenate two strings in PHP?

554


What is inheritance in php?

581


Do you know what is the function mysql_pconnect() usefull for?

506


So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?

559


How to get the length of string?

578


Is it possible to use com component in php?

557


Are sessions stateless?

490