How can we create a database using PHP and mysql?
Answer Posted / ram
mysql_create_db -- Create a MySQL database
syntax: bool mysql_create_db ( string database_name [,
resource link_identifier])
<?php
$con=mysql_connect("localhost","root","");
if(!$con)
{
die("could not connect:".mysql_error());
}
$dbname='CREATE DATABASE prasad';
if(mysql_query($dbname,$con))
{
echo "Database Created successfully";
}
else
{
echo 'error message:' .mysql_error();
}
?>
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Which method do you follow to get a record from a million records? (Searching not from database, from an array in php)?
What is singleton design pattern in php?
What is the use of nl2br() in php?
Is php secure?
Differentiate between require and include?
Is runtime polymorphism overriding?
What is session and Cokkies . How it works . tell some thing about Session_id()
What are sql injections, how do you prevent them and what are the best practices?
What is overloading and overriding in php?
What is fetch array in php?
What is php? Why it is used?
Explain me how to include a file to a php page?
What is a query give example?
Tell me what is the difference between unset() and unlink()?
Tell me can the value of a constant change during the script's execution?