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 $$ in php?

905


Swap two variables value without using third variable in php ?

1006


Can I write php code in html file?

935


Explain some of the php string functions?

914


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

973


What are the file upload settings in configuration file?

982


What are the encryption techniques in php?

954


What is the function of mysql_real_escape_string in php?

881


How to remove a file?

1062


How the values are ordered in an array?

1015


Where can I learn php?

896


What is the content of /etc directory?

962


What is the difference between abstract class and interface in php?

1037


What is the use of count() function in php?

922


Which is the dependent variable?

858