$result = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_TOPICS." WHERE topic_sub='0' ORDER BY topic_title ASC");
if (dbrows($result)) {
$cnt = 0;
while($data = dbarray($result)) {
$id = $data['topic_id'];
$title = $data['topic_title'];
$result1 = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_POST." WHERE topic_id='$id'");
$num_rows1 = dbrows($result1);
echo "<tr><td><a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$title</a><span class='lnk-side'>($num_rows1)</span></td></tr>\n";
}
$cnt++;
}
$result = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_TOPICS." WHERE topic_sub='1' ORDER BY topic_parent_title ASC");
if (dbrows($result)) {
$cnt = 0;
while($data = dbarray($result)) {
$id = $data['topic_id'];
$title = $data['topic_title'];
$parent = $data['topic_parent_title'];
$result1 = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_POST." WHERE topic_id='$id'");
$num_rows1 = dbrows($result1);
echo "<tr><td><a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$parent >$title</a><span class='lnk-side'>($num_rows1)</span></td></tr>\n";
}
$cnt++;
}
<?php
echo "<div class='col-sm-12'>\n";
echo "<table width='100%' border='0'><tr><td><span class='hdspan2'><b>".$locale['gb_810']."</b></span></td></tr></table>\n";
echo "<table align='center' width='80%' border='0'>\n";
$result = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_TOPICS."");
while($data = dbarray($result)) {
$id = $data['topic_id'];
$title = $data['topic_title'];
$sub = $data['topic_parent'];
$result1 = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_POST." WHERE topic_id='$id'");
$num_rows = dbrows($result1);
if($sub>0) {
echo "<tr><td width='15'></td><td>»» <a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$title</a><span style='font-size:11px;color:white;'> [$num_rows posts]</span></td></tr>\n";
} else {
echo "<tr><td colspan='2'><a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$title</a><span style='font-size:11px;color:white;'> [$num_rows posts]</span></td></tr>\n";
}
}
echo "</table><p></div>\n";
?>
$result = dbquery("SELECT child.id, child.title as subtitle, parent.title as parenttitle FROM test AS parent JOIN test AS child ON (child.parent = parent.id)");
while ($data = dbarray($result)) {
echo $data['parenttitle'];
echo "---".$data['subtitle']."<br>";
}
$result = dbquery("SELECT tp.topic_id, tp.topic_title, tp.topic_parent, sp.topic_title, sp.topic_parent FROM ".DB_GRIMS_BLOG_TOPICS." tp
JOIN ".DB_GRIMS_BLOG_TOPICS." sp.topic_id, sp.topic_title, sp.topic_parent WHERE tp.topic_id = sp.topic_parent");
echo "<table align='center' width='80%' border='0'><tr><td>\n";
$result = dbquery("SELECT child.topic_id, child.topic_title as subtitle, parent.topic_title as parenttitle FROM ".DB_GRIMS_BLOG_TOPICS." AS parent
JOIN ".DB_GRIMS_BLOG_TOPICS." AS child ON (child.topic_parent = parent.topic_id");
while ($data = dbarray($result)) {
echo $data['parenttitle'];
echo "---".$data['subtitle']."<br>";
}
echo "</td></tr></table><p></div>\n";
[17-May-2021 07:42:05 America/Chicago] PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on null in /home/whisperw/blog.whisperwillow.net/includes/db_handlers/pdo_functions_include.php:120
Stack trace:
#0 /home/whisperw/blog.whisperwillow.net/grims_blog/include/latest_topics.php(7): dbarray(NULL)
#1 /home/whisperw/blog.whisperwillow.net/grims_blog/include/modules.php(6): include('/home/whisperw/...')
#2 /home/whisperw/blog.whisperwillow.net/grims_blog/index.php(43): include('/home/whisperw/...')
#3 {main}
thrown in /home/whisperw/blog.whisperwillow.net/includes/db_handlers/pdo_functions_include.php on line 120
[17-May-2021 07:42:07 America/Chicago] PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on null in /home/whisperw/blog.whisperwillow.net/includes/db_handlers/pdo_functions_include.php:120
Stack trace:
#0 /home/whisperw/blog.whisperwillow.net/grims_blog/include/latest_topics.php(7): dbarray(NULL)
#1 /home/whisperw/blog.whisperwillow.net/grims_blog/include/modules.php(6): include('/home/whisperw/...')
#2 /home/whisperw/blog.whisperwillow.net/grims_blog/index.php(43): include('/home/whisperw/...')
#3 {main}
thrown in /home/whisperw/blog.whisperwillow.net/includes/db_handlers/pdo_functions_include.php on line 120
[18-May-2021 07:25:37 America/Chicago] PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on null in /home/whisperw/blog.whisperwillow.net/includes/db_handlers/pdo_functions_include.php:120
Stack trace:
#0 /home/whisperw/blog.whisperwillow.net/grims_blog/include/latest_topics.php(8): dbarray(NULL)
#1 /home/whisperw/blog.whisperwillow.net/grims_blog/include/modules.php(6): include('/home/whisperw/...')
#2 /home/whisperw/blog.whisperwillow.net/grims_blog/index.php(43): include('/home/whisperw/...')
#3 {main}
thrown in /home/whisperw/blog.whisperwillow.net/includes/db_handlers/pdo_functions_include.php on line 120
$result = dbquery("SELECT child.topic_id, child.topic_title as subtitle, parent.topic_title as parenttitle FROM ".DB_GRIMS_BLOG_TOPICS." AS parent
JOIN ".DB_GRIMS_BLOG_TOPICS." AS child ON (child.topic_parent = parent.topic_id)");
while ($data = dbarray($result)) {
$id = $data['parent(topic_id)'];
$maintitle = $data['parenttitle'];
$subtitle = $data['subtitle'];
if ($maintitle) {
echo "<tr><td colspan='2'><a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$maintitle</a></td></tr>\n";
}
if ($subtitle) {
echo "<tr><td width='15'></td><td>» <a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$subtitle</td></tr>\n";
}
}
Category Forum
Code Snippet and functions - 8Labels
Statistics
3 participants
Notifications
You are not receiving notifications from this thread.
Related Questions