-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbtryOut.php
56 lines (39 loc) · 881 Bytes
/
dbtryOut.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
<?php
/*$server = "localhost";
$username = "root";
$password = "";
$database = "art_store";
$con = mysqli_connect($server, $username, $password, $database);
// Check connection
if (!$con) {
echo "sad";
}
$image = "SELECT * FROM artworks";
$result = $con->query($image);
while($row = $result->fetch_assoc())
{
echo $row['imageFileName'];
}
$con->close();
*/?>
<?php
$server = "localhost";
$username = "root";
$password = "";
$database = "art_store";
$con = mysqli_connect($server, $username, $password, $database);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
$image = "select imageFileName from artworks order by view LIMIT 3";
$result = $con->query($image);
$con->close(); ?>
<?php
while($row = $result->fetch_array()){
$row = $result;
}
echo $row[0];
?>
<?php echo $result[0]; ?>
<?php echo $result[1]; ?>