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

How to convert one date format into another in php?

682


Tell me what is pear?

758


What is the difference between htmlentities and htmlspecialchars in php?

687


If we login more than one browser windows at the same time with same user and after that we close one window, then is the session is exist to other windows or not? And if yes then why? If no then why?

657


Define soundex()?

683


What is meant by pear in php? What is the purpose of it?

699


What is session_start () in php?

706


How to check your php installation?

718


Is php an api?

726


What is is_null() in php?

759


Which function is used to strip whitespace?

678


What is the main difference between require() and require_once()?

748


What is super () python?

733


What are the characteristics of php?

733


Tell me what is the difference between the functions strstr() and stristr()?

745