-
Notifications
You must be signed in to change notification settings - Fork 2
/
database_format.php
75 lines (66 loc) · 3.19 KB
/
database_format.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
// Access and authenticate the cloud SQL Database
include "config.php";
//Add unique ID via SQL
//dbContributions
//Add 6-8 digit unique IDs to db Contributions Table
//ALTER TABLE dbContributions ADD `uniquekey` int(10);
//UPDATE dbContributions SET `uniquekey`=ROUND(1+RAND()*99999999) WHERE 1
//Add unique ID via SQL
//dbProducts
//Add 6-8 digit unique IDs to db Products Table
//ALTER TABLE dbProducts ADD `uniquekey` int(10);
//UPDATE dbProducts SET `uniquekey`=ROUND(1+RAND()*99999999) WHERE 1
//Add unique ID via SQL
//dbProvidors
//Add 6-8 digit unique IDs to db Products Table
//ALTER TABLE dbProvidors ADD `uniquekey` int(10);
//UPDATE dbProvidors SET `uniquekey`=ROUND(1+RAND()*99999999) WHERE 1
//Add unique ID via SQL
//dbShipments
//Add 6-8 digit unique IDs to db Products Table
//ALTER TABLE dbShipments ADD `uniquekey` int(10);
//UPDATE dbShipments SET `uniquekey`=ROUND(1+RAND()*99999999) WHERE 1
?>
<?php
$Search = mysqli_query($con,"SELECT * FROM dbContributions");
while($Found = mysqli_fetch_array($Search))
{
// If the data has years from 1900s then this code needs to be changed before running
//09-03-29:17:28 Original Date Time String
$unique_entry = $Found['uniquekey'];
$receive_date = $Found['receive_date'];
$receive_date = "20".substr($receive_date, 0,8);
$date = new DateTime($receive_date);
$new_date = $date->format('m/d/Y');
$result = mysqli_query($con,"UPDATE dbContributions SET receive_date='$new_date' WHERE uniquekey='$unique_entry'");
}
$Search = mysqli_query($con,"SELECT * FROM dbProducts");
while($Found = mysqli_fetch_array($Search))
{
$initial_date = "";
// If the data has years from 1900s then this code needs to be changed before running
//06-04-25 Original Date Time String
$unique_entry = $Found['uniquekey'];
$initial_date = $Found['initial_date'];
if($initial_date) {
$initial_date = "20".substr($initial_date, 0,8);
$date = new DateTime($initial_date);
$new_date = $date->format('m/d/Y');
$result = mysqli_query($con,"UPDATE dbProducts SET initial_date='$new_date' WHERE uniquekey='$unique_entry'");
}
}
$Search = mysqli_query($con,"SELECT * FROM dbShipments");
while($Found = mysqli_fetch_array($Search))
{
// If the data has years from 1900s then this code needs to be changed before running
//09-03-29:17:28 Original Date Time String
//00-09-01:00:63
$unique_entry = $Found['uniquekey'];
$receive_date = $Found['receive_date'];
$receive_date = "20".substr($receive_date, 0,8);
$date = new DateTime($receive_date);
$new_date = $date->format('m/d/Y');
$result = mysqli_query($con,"UPDATE dbContributions SET receive_date='$new_date' WHERE uniquekey='$unique_entry'");
}
?>