-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_table.php
33 lines (27 loc) · 1018 Bytes
/
create_table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
//Check create_database.php code before you this.
//Run this script to generate the required tables in your local computer (WampServer).
//This script only needs to be run once. Then, you can use these tables by simply connecting to the database.
$con = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('vtc');
$sql = "CREATE TABLE persons
(PID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name CHAR(50) NOT NULL,
Email CHAR(50) NOT NULL UNIQUE,
Password CHAR(50) NOT NULL,
Contact CHAR(50) NOT NULL,
City CHAR(50) NOT NULL,
Address CHAR(50) NOT NULL)";
if (mysql_query($sql))
echo "persons table successfully created"."<br>";
else
echo "Error in creating Persons table: ".mysql_error()."<br>";
$sql = "CREATE TABLE flowers
(PID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Price INT(10) NOT NULL)";
if (mysql_query($sql))
echo "Flowers table successfully created"."<br>";
else
echo "Error in creating Flowers table: ".mysql_error()."<br>";
mysql_close($con);
?>