How can we create a database using PHP and mysql?

Answer Posted / vivek mohan singh

$dbhost = "localhost"; // database hostname
$dbuser = "root"; // database username
$dbpassword = ""; // database password
$dbname = ""; // database name

//database connection
$link=mysql_connect($dbhost,$dbuser,$dbpassword) or die ('I
cannot connect to the database because: ' . mysql_error());
mysql_select_db($dbname ,$link);

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a base url?

713


How does php work with apache?

732


Explain what is the use of "echo" in php?

792


What is Mcrypt used for?

774


What is Apache's configuration file typically called?

808


What is whitespace in html?

719


Is strcmp case sensitive?

739


What is php beginner?

716


How to set a value in session? How to remove data from a session?

763


What is the use of mysql_fetch_assoc in php?

748


Is null empty php?

751


What is singleton pattern in php?

677


What is use of count() function in php?

784


What does session start do in php?

727


What sized websites have you worked on in the past?

761