forked from georgelu/Quotely
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.php
More file actions
51 lines (39 loc) · 2.01 KB
/
Copy pathcontent.php
File metadata and controls
51 lines (39 loc) · 2.01 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
50
51
<?php
include("config.php");
// finding number of total items in each category
if ($subid) {
$temp_query = "select * from quotely where subcat = '" . $subcat . "'";
$temp_result = mysql_query($temp_query);
$num_items_in_category = mysql_num_rows($temp_result);
if ($num_items_in_category < $subid) {
$subid = '1';
}
$query = "select * from quotely where subcat = '" . $subcat . "' AND subid = '" . $subid ."'";
$category = $subcat;
$id = $subid;
} else if ($id) {
$temp_query = "select * from quotely where category = '" . $category . "'";
$temp_result = mysql_query($temp_query);
$num_items_in_category = mysql_num_rows($temp_result);
if ($num_items_in_category < $id) {
$id = '1';
}
$query = "select * from quotely where category = '" . $category . "' AND id = '" . $id ."'";
} else {
$query = "select * from quotely where category = '" . $category . "' AND id = '1'";
}
$result = mysql_query($query);
// This tells you how many rows were returned
$num_rows = mysql_num_rows($result);
while ($row = mysql_fetch_assoc($result)) {
echo "<blockquote id='quotation'>" . $row["quote"] . "</blockquote>";
echo "<cite id='speaker'><p>- " . $row["speaker"] . "</p></cite>";
if ($subid) {
echo "<a href='wiki.php?sc=" . $category . "&si=" . $id . "&u=" . $row["wikipedia"] . "'><small>+ Read more about this speaker at Wikipedia »</small></a>";
echo "<p><small id='source'><a href='source.php?sc=" . $category . "&si=" . $id . "&u=" . $row['sourcelink'] . "'>+ See the full story at ". $row["source"] . " »</a></small></p>";
} else {
echo "<a href='wiki.php?c=" . $category . "&i=" . $id . "&u=" . $row["wikipedia"] . "'><small>+ Read more about this speaker at Wikipedia »</small></a>";
echo "<p><small id='source'><a href='source.php?c=" . $category . "&i=" . $id . "&u=" . $row['sourcelink'] . "'>+ See the full story at ". $row["source"] . " »</a></small></p>";
}
}
?>