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

How do we get the current session id?

556


Is php an object or array?

519


Is numeric in php?

535


What is get and post method in php?

528


Where do we use get and post?

531






How to find a specific value in an array?

511


write a note on Testing the web site

1420


How to get a total number of elements used in the array?

508


Tell me what the difference between the 'bitwise and' operator and the 'logical and' operator?

533


What is the meaning of xdebug?

548


Why php is widely used?

549


Why many companies are switching their current business language to php?

593


In php, objects are they passed by value or by reference?

526


What is slim framework?

508


What are the difference between overloading and overriding in oops?

542