Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Create a New Database
How To Create a New Database? - MySQL FAQs - PHP Connections and Query Execution
✍: FYIcenter.com
A database in a MySQL server is a logical container used to group tables and other data objects together as a unit. If you are a the administrator of the server, you can create a new databases using the CREATE DATABASE statements with MySQL client interface programs.
If you want to create a new database with a PHP script, you can still use deprecated function, mysql_create_db(). But it's better use the mysql_query($sql,$con) function to create new databases. The tutorial exercise below shows you how to create a database called "fyi":
<?php
$con = mysql_connect('localhost:8888', 'dev', 'iyf');
$sql = 'CREATE DATABASE fyi';
if (mysql_query($sql, $con)) {
print("Database fyi created.\n");
} else {
print("Database creation failed.\n");
}
mysql_close($con);
?>
If you run this script, you will get something like this:
Database fyi created.
2007-05-10, 4946👍, 0💬
Popular Posts:
What are some uses of Intranets & Extranets? An "intranet" is the generic term for a collect...
WHat will be the result of the following code? #define TRUE 0 // some code while (TRUE) { // some co...
What’ is the sequence in which ASP.NET events are processed ? Following is the sequence in which the...
How do I use a scriptlet to initialize a newly instantiated bean? A jsp:useBean action may optionall...
How do you pass control from one JSP page to another? Use the following ways to pass control of a re...