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
How are php sessions stored?
Is php good for career?
How do you check if an arraylist is empty?
Which is used to maintain the value of a variable over different pages?
What is the difference between explode and split?
What are majic methords in php?
How to create database connection and query in php?
How do I clear my browser session?
How to create a text file in PHP?
What is default session time in php?
When is a conditional statement ended with an endif?
How to register a variable in PHP session?
How come the code works, but does not for two-dimensional array of mine?
What is the purpose of break and continue statement?
What is the difference between explode () and split () functions in php?