-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_H_table.php
53 lines (34 loc) · 903 Bytes
/
create_H_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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Created by PhpStorm.
* User: XiaowenJiang
* Date: 3/1/15
* Time: 15:10
*/
$host = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "stock";
$conn = mysqli_connect($host,$username, $password);
$companies=array("AAPL_h","EDU_h","GOOG_h","MSFT_h","YHOO_h","FB_h","TWTR_h","AMZN_h","INTC_h","IBM_h");
mysqli_select_db($conn,"stock");
for($i=0;$i<10;$i++)
{
$sql1="drop table $companies[$i]";
// change the table name to create corresponding table
$sql = "create table $companies[$i]
(
date Date,
open double,
high double,
low double,
close double,
volume int,
adj_close double,
primary key(date,open,high,low,close,volume,adj_close)
)";
mysqli_query($conn,$sql1);
mysqli_query($conn,$sql);
}
mysqli_close($conn);
?>