How can we create a database using PHP and mysql?
Answers were Sorted based on User's Feedback
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 |
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 |
Answer / b.chandrasekaran
using
mysql_db_create("databasename");
we can create new database in php.
| Is This Answer Correct ? | 1 Yes | 1 No |
What is crypt () in php?
How can I reverse sort an array keeping the correlation between the index and value?
2 Answers Rushmore Consultancy,
What is http get and post?
What is restful api?
what are the current or latest versions of LAMP ? Linux, Apache, MySql, PHP
What are the rules for naming a php variable?
What is the difference between mysql_fetch_object and mysql_fetch_array?
Is c similar to php?
What is the functionality of the function html entities?
How to call javascript function in php on button click?
How to send email using php script?
hello friend koi mujhe bata skta ke php easy way se aur jaldi kese seekh skte h...plz im waiting for ur answer..