Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can we create a database using PHP and mysql?

Answer Posted / tina

1.mysql_connect('ip address/localhost','username for
mysql','password');
i.e
$con=mysql_connect('localhost','root','sdsd');
here,$con is a user defined variable.

2.$quer=CREATE DATABASE sampdb;
mysql_query($quer,$con);

Here,$quer is also user defined variable.

if(mysql_query($quer,$con)
{
echo("DATABASE WAS BEEN CREATED");
}
else
echo("NOT CREATED");

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between static and final in php?

1013


What does PEAR stands for?

1046


How to return a value back to the function caller?

1031


Do you know what is the use of rand() in php?

983


Explain the installation of PHP on UNIX systems?

1110


What is composer phar?

998


Write down the code for saving an uploaded file in PHP.

1068


What is the difference between explode() and split() functions?

1049


What is Type hinting in PHP?

1148


What is difference between print_r and echo in php?

891


What is difference between rest api and restful api?

984


What is meant by PEAR in PHP?

975


How many types of array supported in php?

980


Which function is used to strip whitespace?

972


Explain the different types of errors in php.

1073