blob: 32d28010ab53e2c4b7453f875b00da9de90a3249 (
plain)
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
|
<?php
include "connect_database.php";
$sql;
if (isset($ism) && $ism != null) {
$sql = "SELECT * FROM qarzdorlar WHERE ism = $ism";
} else {
$sql = "SELECT * FROM qarzdorlar";
}
$result = $conn->query($sql);
$users;
$min_user;
$max_user;
$sum_duty = 0;
$min_duty = 99999999999;
$max_duty = 0;
for ($i = 0, $j = 0; $i < $result->field_count; $i++) {
while ($row = $result->fetch_assoc()) {
$users[$j] = $row;
$sum_duty += $row["miqdor"];
if ($row["miqdor"] < $min_duty) {
$min_user = $row;
$min_duty = $row["miqdor"];
}
if ($row["miqdor"] > $max_duty) {
$max_user = $row;
$max_duty = $row["miqdor"];
}
$j++;
}
}
?>
|