How can we create a database using PHP and mysql?

Answer Posted / sunil kumar

It`s simple than above

<?php
mysql_connect("localhost","root","");//connect to host
$sql_create_db="create database my_db";
if(mysql_query($sql_create_db))
echo"Database is created";
else
echo"Error in creating Database".mysql_error();

?>

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why session timeout is important?

621


What are default session time and path?

559


What is the tags in PHP is not a valid way to begin and end a PHP code block?

787


Php says that an array is an ordered map. But how the values are ordered in an array?

593


Are parent constructors called implicitly inside a class constructor?

514






How to get ip address of a server in php?

545


Does session expire on closing browser?

487


What is mysql_fetch_array?

521


What are the different data types in javascript?

518


What is the use of curl()?

629


Write a program using while loop in php?

569


Is polymorphism inherited?

523


What is php addslashes?

539


How a constant is defined in a php script?

562


What is basename php?

515