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
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 |
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 |
Answer / shweta
database name must be wrong or you can use IP address
instead of 'localhost'.
Is This Answer Correct ? | 0 Yes | 0 No |
What is difference between strstr() and stristr() in PHP?
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
Who created numbers?
what are the various PHP Script Optimization techniques?
1 Answers IBM, Krify Software Technologies, TCL,
How do I run a php file?
Name the Functions in IMAP, POP3 AND LDAP?
What is difference between count or sizeof function in php?
How can we get the properties (size, type, width, height) of an image using PHP image functions?
What is a base url?
I have written a source code in php but I do not know how to compile that and conduct it with a website please explain me the how to compile that ?
What is namespaces in PHP?
What is php and its advantages?