Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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)

Answers were Sorted based on User's Feedback



i got this error msg in online... how to solve this problem... i couldnot find out as soon as possi..

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

i got this error msg in online... how to solve this problem... i couldnot find out as soon as possi..

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

i got this error msg in online... how to solve this problem... i couldnot find out as soon as possi..

Answer / shweta

database name must be wrong or you can use IP address
instead of 'localhost'.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

What are the difference between abstract class and interface?

4 Answers  


What's the diff. between include() and Include_once().

5 Answers   Intrack,


Which is better mysql or sql?

0 Answers  


Tell me what does accessing a class via :: means?

0 Answers  


Can you define an array argument as a reference type?

0 Answers  


Explain different sorting function in php?

0 Answers  


Can I learn php without knowing c?

0 Answers  


What is associative array in php?

0 Answers  


Describe the differences between the object models in PHP 4 and PHP 5.

1 Answers  


what method is used to generate a random number?

4 Answers  


What is the difference between apache and tomcat?

0 Answers  


What is session in PHP. How to remove data from a session?

0 Answers  


Categories