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?

Answers were Sorted based on User's Feedback



How can we create a database using PHP and mysql?..

Answer / 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

How can we create a database using PHP and mysql?..

Answer / vivek mohan singh

$dbhost = "localhost"; // database hostname
$dbuser = "root"; // database username
$dbpassword = ""; // database password
$dbname = ""; // database name

//database connection
$link=mysql_connect($dbhost,$dbuser,$dbpassword) or die ('I
cannot connect to the database because: ' . mysql_error());
mysql_select_db($dbname ,$link);

Is This Answer Correct ?    6 Yes 5 No

How can we create a database using PHP and mysql?..

Answer / b.chandrasekaran

using
mysql_db_create("databasename");

we can create new database in php.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More PHP Interview Questions

Is it possible to protect special characters in a query string?

0 Answers  


What is nginx and what is it used for?

0 Answers  


What is a php session?

0 Answers  


Explain what is the main difference between require() and require_once()?

0 Answers  


How do you use bcrypt for hashing passwords in php?

0 Answers  


What is the difference between pop3 IMAP and MAPI?

0 Answers  


Swap two variables value without using third variable in php ?

0 Answers   MCN Solutions,


What is the difference between htmlentities() and htmlspecialchars()?

0 Answers  


How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using regular expression of PHP?

6 Answers  


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

1 Answers  


How to find the length of a string?

0 Answers  


Is md5() is breakable if yes than how?

1 Answers  


Categories