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 / asheesh

database connection was not established yet that's why this
error is occuring.

$con=mysql_connect("localhost","root","password") or die
(mysql_error());
$link=mysql_select_db('test',$con);
if(!$link)
{
die(mysql_error());
}
"root" is the user name
"test" is the database name

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to set cookies in PHP?

600


How to support multiple-page forms?

567


What does echo mean in php?

558


What is basic php?

543


What is difference between explode() or split() in PHP?

494






What is php explain?

513


What is the delimiter syntax is PHP's default delimiter syntax

749


Which library is used in php to do various types of image work?

517


What is the use of Php variables?

591


How to process the uploaded files?

590


How do you destroy a session?

503


What is "print" in php?

524


Where do we use get and post?

531


What is the best php framework 2018?

538


What is polymorphism in php?

513