-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdrugs-prices.php
More file actions
32 lines (27 loc) · 676 Bytes
/
Copy pathdrugs-prices.php
File metadata and controls
32 lines (27 loc) · 676 Bytes
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
<?php
$user = 'root';
$password = 'root';
$db = 'globalcollapse';
$host = 'localhost';
$port = 3306;
$link = mysqli_init();
$success = mysqli_real_connect(
$link,
$host,
$user,
$password,
$db,
$port
);
for ($i = 1; $i <= 5; $i++) {
$drug = mysqli_query($link, "SELECT * FROM `drugs` WHERE `id` = '$i' LIMIT 1");
$row = mysqli_fetch_assoc($drug);
$pastprice = $row['price'];
$min = $row['min'];
$max = $row['max'];
$newprice = rand($min, $max);
mysqli_query($link, "UPDATE `drugs` SET `price` = '$newprice', `past_price` = '$pastprice', `updated` = now() WHERE `id` = '$i'");
}
mysqli_close($link);
header("Location: https://www.google.com");
?>