-
Notifications
You must be signed in to change notification settings - Fork 0
/
count_titles.php
42 lines (30 loc) · 1.67 KB
/
count_titles.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
<?php
include "include/connect.php";
include "include/gensettings.php";
include "user.php";
echo "<table><tr>";
echo "<td>Title</td>" . "<td>Author Name</td>" . "<td>Total<td></tr>";
$sql_1 = "SELECT * from card_cat where flag='up'";
$result = mysql_query($sql_1, $connect) or die("cant execute query!z");
$lahatan = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
$title = $row['title'];
$author_sname = $row['author_sname'];
$author_fname = $row['author_fname'];
$author_mname = $row['author_mname'];
$sql_2 = "SELECT * from card_cat where title = '$title' && author_sname='$author_sname'&& author_fname='$author_fname'&& author_mname='$author_mname' && flag='up'";
$result_2 = mysql_query($sql_2, $connect) or die("cant execute query!y");
$lahatan_2 = mysql_num_rows($result_2);
$sql_2b = "SELECT * from card_cat where title = '$title' && author_sname='$author_sname'&& author_fname='$author_fname'&& author_mname='$author_mname' && qty=1";
$result_2b = mysql_query($sql_2b, $connect) or die("cant execute query!y");
$lahatan_2b = mysql_num_rows($result_2b); //available copies
$sql_3 = "UPDATE card_cat set flag='down' where title = '$title' && author_sname='$author_sname'&& author_fname='$author_fname'&& author_mname='$author_mname'";
$result_3 = mysql_query($sql_3, $connect) or die("cant execute query!x");
if ($lahatan_2 == 0) {
} else {
echo "<tr><td>$title</td>" . "<td>$author_sname.$author_fname</td>" . "<td>$lahatan_2<td>" . "<td>$lahatan_2b<td>";
}
}
echo "</tr></table>";
$sql_4 = "UPDATE card_cat set flag='up' ";
$result_4 = mysql_query($sql_4, $connect) or die("cant execute query!v");