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 Database
How To Create a Database? - PHP Script Tips - Working with MySQL Database
✍: 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 and delete databases using the CREATE/DROP DATABASE statements. The following PHP script shows you how to create and drop an database called "fyi":
<?php
$con = mysql_connect('localhost');
$sql = 'CREATE DATABASE fyi';
if (mysql_query($sql, $con)) {
print("Database fyi created.\n");
} else {
print("Database creation failed.\n");
}
$sql = 'DROP DATABASE fyi';
if (mysql_query($sql, $con)) {
print("Database fyi dropped.\n");
} else {
print("Database drop failed.\n");
}
mysql_close($con);
?>
If you run this script, you will get something like this:
Database fyi created. Database fyi dropped.
2007-04-18, 5186👍, 0💬
Popular Posts:
In C#, what is a weak reference? Generally, when you talk about a reference to an object in .NET (an...
How To Give a User Read-Only Access to a Database? - MySQL FAQs - Managing User Accounts and Access ...
When does the compiler not implicitly generate the address of the first element of an array? Wheneve...
How To Return Top 5 Rows? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries If you want ...
Describe different elements in Static Chart diagrams ? Package: - It logically groups element of a U...