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 a http session?

940


What are the different ways to login to a remote server? Explain the me, advantages and disadvantages?

1061


What is session in c#?

982


Why do we use htaccess

1062


What is the method to register a variable into a session?

847


How can I prevent sql-injection in php?

1017


What is "echo" in php?

968


What is the function file_get_contents() useful for?

932


What does the initials of php stand for?

949


Do you know what is php?

1015


How error handling is being handled by php?

1050


How to strip whitespace (or other characters) from the beginning and end of a string?

882


What is the different between count() and sizeof() in php?

952


What is difference between php and html?

1040


What is session cookies php?

984