-
Notifications
You must be signed in to change notification settings - Fork 5
/
book.php
36 lines (27 loc) · 1.17 KB
/
book.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
<?php
$con = mysql_connect("127.0.0.1","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mandg_book0", $con);
$result_chapters = mysql_query("select wp_posts.ID, post_title,display_name from wp_posts LEFT JOIN wp_users on wp_posts.post_author = wp_users.ID where post_type != 'revision' order by post_date");
$result_bodies = mysql_query("select wp_posts.ID, post_title,display_name, post_date_gmt, post_content from wp_posts LEFT JOIN wp_users on wp_posts.post_author = wp_users.ID where post_type != 'revision' order by post_date");
?>
<div id="toc">
<h1>Contents</h1>
<?php
while($chapters = mysql_fetch_array($result_chapters))
{
echo '<LI class="chapter"><A href="#'.$chapters['ID'].'">'.$chapters['ID'].' - '.$chapters['post_title']." - ".$chapters['display_name'].'</A></LI>';
}
?>
</div>
<?php
while($bodies = mysql_fetch_array($result_bodies))
{
echo '<h1><a name="'.$bodies['ID'].'" id ="'.$bodies['ID'].'">'.$bodies['ID'].' - '.$bodies['post_title'].'</h1><span class="author">'.$bodies['display_name'].' on '.$bodies['post_date_gmt'].'</span>';
echo nl2br($bodies['post_content']);
}
mysql_close($con);
?>