-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateweightbrackets.php
More file actions
49 lines (37 loc) · 1.12 KB
/
Copy pathgenerateweightbrackets.php
File metadata and controls
49 lines (37 loc) · 1.12 KB
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
<?php
$dsn = "mysql:host=blitz.cs.niu.edu;dbname=csci467";
$username = "student";
$password = "student";
try
{
$pdo = new PDO($dsn, $username, $password);
}//end of try
catch(PDOexception $e)
{
echo $e->getMessage();
}//end of catch
$dsn2 = "mysql:host=courses;dbname=z1808910";
$username2 = "z1808910";
$password2 = "1994Aug19";
try
{
$pdo2 = new PDO($dsn2, $username2, $password2);
}//end of try
catch(PDOexception $e)
{
echo $e->getMessage();
}//end of catch
$query = "SELECT * from parts;";
$sql = $pdo->query($query);
$rows = $sql->fetchAll();
foreach($rows as $value)
{
$number = rand (2,100);
$query = "INSERT INTO PartInventory VALUES(";
$query .= $value[0];
$query .= ",";
$query .= "$number";
$query .= ");";
$sql2 = $pdo2->query($query);
}
?>