-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry_display.php
More file actions
88 lines (61 loc) · 1.76 KB
/
entry_display.php
File metadata and controls
88 lines (61 loc) · 1.76 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
$couch_dsn = "http://localhost:5984/";
$couch_db = "nosql";
/**
* include the library
*/
require_once "couch.php";
require_once "couchClient.php";
require_once "couchDocument.php";
/**
* create the client
*/
$client = new couchClient($couch_dsn,$couch_db);
$qs_title = $_GET['title'];
#echo "$title";
$delete = "http://localhost/noSQL/deleteArticle.php?title=".$qs_title;
$edit = "http://localhost/noSQL/editArticle.php?title=".$qs_title;
$all_docs = $client->getAllDocs();
#echo "Database got ".$all_docs->total_rows." documents.<BR>\n";
#echo "<table id=\"hor-minimalist-b\">\n<tr><th>Title</th><th>Text</th><tr>\n\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>toDo</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<script type="text/javascript" src="calendarDateInput.js"></script>
<body>
<div id="wrap">
<div id="main">
<?php
foreach ( $all_docs->rows as $row ) {
#echo "".$row->id."<BR>\n";
#echo "".$row->title."<BR>\n";
/* this just gets an id so need to retrieve document */
$doc = $client->getDoc($row->id);
$title = $doc->title;
$body = $doc->body;
if($title == $qs_title)
{
echo "<tr><td><h1>$title</h1></td><td >$body</td></tr>\n";
}
}
?>
</table>
</div>
<div style = "width: 300px; padding-top: 100px">
<a href='index.php'>Back to main page</a>
</br>
<?php
echo "<a href=\"$delete\">Delete this article</a>";
echo " ";
echo "<a href=\"$edit\">Edit this article</a>";
?>
</div>
</div>
</body>
</html>