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
What is Mcrypt used for?
Why do we use interface in php?
What is singleton pattern in php?
What is final keyword in php?
How to run a php script?
What is binary safe function in php?
What is php.ini & .htacess file?
How do you remove whitespace from the beginning and end of a $string variable?
What are Routines?
How is the ternary conditional operator used in php?
Does php support function overloading?
How can you encrypt password using php?
Is it possible to destroy a cookie?
What is trait in php?
Is php free to use?