Tools, FAQ, Tutorials:
Creating a Database in PHP
How To Create a Database in PHP?
✍: 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 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 a 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.
⇒ Selecting an Existing Database in PHP
⇐ Connecting to a MySQL Server in PHP
2016-10-20, 1563🔥, 0💬
Popular Posts:
What is Azure API Management Publisher Dashboard? Azure API Management Publisher Dashboard is an Azu...
How to read RSS validation errors at w3.org? If your RSS feed has errors, the RSS validator at w3.or...
Can Two Forms Be Nested? Can two forms be nested? The answer is no and yes: No. You can not nest two...
How to start Docker Daemon, "dockerd", on CentOS systems? If you have installed Docker on your CentO...
Where to find tutorials on Using Azure API Management Developer Portal? Here is a list of tutorials ...