/
dummy.php
38 lines (31 loc) · 892 Bytes
/
dummy.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
<?php
$servername = "localhost";
$username = "root";
$password = "12345";
$dbname = "dbelprowin";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$i = 1;
while($i < 17){
$sql = "INSERT INTO hasil_belajar (nama, materi, classdir, labdir) VALUES ('213',".$i.", 'tugas', 'tugas')";
if ($conn->query($sql) === TRUE) {
$last_id = $conn->insert_id;
$sql2 = "INSERT INTO rapor (hasil, detail_nilai, nclass, nlab, kclass, klab ) VALUES (".$last_id.", '..', 80, 80, 'L', 'L')";
if ($conn->query($sql2) === TRUE) {
echo "Data Dummy sudah masuk";
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
$i++;
}
?>