<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — FAQ Mod?]]></title>
		<link>https://punbb.informer.com/forums/topic/3426/faq-mod/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/3426/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in FAQ Mod?.]]></description>
		<lastBuildDate>Thu, 18 Mar 2004 16:53:57 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11380/#p11380</link>
			<description><![CDATA[<p><a href="http://punbb.org/forums/viewtopic.php?pid=11378#11378">FAQ Mod v1.0 released!!!</a></p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Thu, 18 Mar 2004 16:53:57 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11380/#p11380</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11358/#p11358</link>
			<description><![CDATA[<p>No way! It&#039;s 4:47 here, I should go to bed... if I can still find it <img src="https://punbb.informer.com/forums/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>Have pun <img src="https://punbb.informer.com/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (MarcB)]]></author>
			<pubDate>Thu, 18 Mar 2004 03:48:21 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11358/#p11358</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11357/#p11357</link>
			<description><![CDATA[<p>SUCCESS!!!!!!</p><p>sorry &#039;bout the confusion but it&#039;s working now as expected!!</p><p>Thanks a ton for your help, MarcB!!!<br />Stay tuned for a MOD release....</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Thu, 18 Mar 2004 03:44:58 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11357/#p11357</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11356/#p11356</link>
			<description><![CDATA[<p>Ok, first thing, you didn&#039;t modify the query as I suggested, which as I also stated might not be well done unless you have an &#039;id&#039; field in the table. In this case, simply take the $id out of the while condition, cause the fields won&#039;t match.<br />Second, that&#039;s my error (sorry) you need to comment out the list command immediately after the while condition.</p><p>That should solve your problems.</p>]]></description>
			<author><![CDATA[null@example.com (MarcB)]]></author>
			<pubDate>Thu, 18 Mar 2004 03:38:40 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11356/#p11356</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11354/#p11354</link>
			<description><![CDATA[<p>Well, progress, I think...</p><p>As you can see in the code below...<br />I changed the while statement as you suggested (correcting for the round bracket ending up on the next line...)<br />I also commented out the first list statement since it was not in your code...<br /></p><div class="codebox"><pre><code>// Fetch some info from the faq
$result = $db-&gt;query(&#039;SELECT faq_name, question, answer, disp_position FROM &#039;.$db-&gt;prefix.&#039;faq ORDER BY disp_position&#039;) or error(&#039;Unable to fetch faq info&#039;, __FILE__, __LINE__, $db-&gt;error());
if (!$db-&gt;num_rows($result))
    message($lang_common[&#039;Bad request&#039;], true);

//list($faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result);


if ($db-&gt;num_rows($result))
{
    while (list($id, $faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result))
    {
    list($faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result);
?&gt;    

    &lt;tr&gt;
        &lt;td class=&quot;puncon1&quot; style=&quot;width: 25%; vertical-align: top&quot; &gt;&lt;p style=&quot;margin-bottom: 0&quot;&gt;&lt;b&gt;&lt;?php echo $lang_faq[&#039;question&#039;].$disp_position.&#039;&lt;/p&gt;&lt;p style=&quot;margin-left: 10px; margin-top: 5px; margin-bottom: 5px&quot;&gt;&lt;/b&gt;&#039;.$question ?&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td class=&quot;puncon2&quot; style=&quot;vertical-align: top&quot;&gt;&lt;p style=&quot;margin-bottom: 0&quot;&gt;&lt;b&gt;&lt;?php echo $lang_faq[&#039;answer&#039;].&#039;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 10px; margin-top: 5px; margin-bottom: 5px&quot;&gt;&#039;.$answer ?&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;

&lt;?php    
        }
}
else    
    echo &quot;\t&quot;.&#039;&lt;tr&gt;&lt;td class=&quot;puncon1&quot; colspan=&quot;6&quot;&gt;&#039;.$lang_faq[&#039;Empty FAQ&#039;].&#039;&lt;/td&gt;&lt;/tr&gt;&#039;.&quot;\n&quot;;

?&gt;</code></pre></div><p>I now get record #2 only and a blank record. (there should be 3 records.)<br />I didn&#039;t really understand what you said about this in your last post, could you clarify it for me?</p><p>I really appreciate your help on this!!!</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Thu, 18 Mar 2004 00:13:49 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11354/#p11354</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11347/#p11347</link>
			<description><![CDATA[<p>Try this:</p><div class="codebox"><pre><code>// Fetch some info from the faq
$result = $db-&gt;query(&#039;SELECT id,faq_name, question, answer, disp_position FROM &#039;.$db-&gt;prefix.&#039;faq ORDER BY disp_position&#039;) or error(&#039;Unable to fetch faq info&#039;, __FILE__, __LINE__, $db-&gt;error());
if (!$db-&gt;num_rows($result))
    message($lang_common[&#039;Bad request&#039;], true);

if ($db-&gt;num_rows($result))
{
    while (list($id, $faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result);
)
    {
    list($faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result);
?&gt;    

    &lt;tr&gt;
        &lt;td class=&quot;puncon1&quot; style=&quot;width: 240px; vertical-align: top&quot; &gt;&lt;p style=&quot;margin-bottom: 0&quot;&gt;&lt;b&gt;&lt;?php echo $lang_faq[&#039;question&#039;].$disp_position.&#039;&lt;/p&gt;&lt;p style=&quot;margin-left: 10px; margin-top: 5px; margin-bottom: 5px&quot;&gt;&lt;/b&gt;&#039;.$question ?&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td class=&quot;puncon2&quot; style=&quot;vertical-align: top&quot;&gt;&lt;p style=&quot;margin-bottom: 0&quot;&gt;&lt;b&gt;&lt;?php echo $lang_faq[&#039;answer&#039;].&#039;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 10px; margin-top: 5px; margin-bottom: 5px&quot;&gt;&#039;.$answer ?&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;</code></pre></div><p>Please note two things:<br />1) I assumed there&#039;s an id field on the table. Might not be so.<br />2) Since you&#039;re not using the $id variable you could take it off, but if you want to make links to these faqs or something, you might need it. Can&#039;t say.</p><p>I just erased the $id=... from the while and substituted it from the real one. You should as well erase the first one, or you&#039;ll always miss the first record. I think the recordcount should work exactly the same, but if it doesn&#039;t (if you get an empty recordset) you&#039;ll have to change the while bucle to a do while or erase the recordcount if and use a trafficlight variable inside the bucle, so as to know if the recordset was really empty or not (that might be the most speed effective solution, although not the most elegant) that way, I&#039;d do something like:<br />$light=true;<br />while {... $light=false;}<br />if ($light) then echo(&#039;empty&#039;);</p><p>Hope that solves your problem.</p>]]></description>
			<author><![CDATA[null@example.com (MarcB)]]></author>
			<pubDate>Wed, 17 Mar 2004 22:54:05 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11347/#p11347</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11344/#p11344</link>
			<description><![CDATA[<p>did some more messing around with the code (you&#039;re all cringing, aren&#039;t you!)<br />Anyway, the updated code is above and I&#039;m only getting the first record which means that it&#039;s not looping, right?&nbsp; well, that probably has to do with the fact that $id is undefined (as Rickard noted). You&#039;ll see that I&#039;ve commented out Rickard&#039;s suggestion because it was causing the Bad Request because there is no value for &#039;Get&#039; to get.</p><p>edit:<br />actually, I get the last record...</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Wed, 17 Mar 2004 19:17:11 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11344/#p11344</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11338/#p11338</link>
			<description><![CDATA[<p>Thanks MarcB, that helped...<br />{updated above code, again}</p><p>but if it ain&#039;t one thing.... it&#039;s something else!!</p><p>now I only get the last record (as determined by dips_position) if a change the order in the admin_faq, the displayed record changes appropriately...&nbsp; I suspect I need to reset the array or something like that?&nbsp; I&#039;m going to poke around the other files and see what I find. (It&#039;s kinda like a scavenger hunt!)</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Wed, 17 Mar 2004 15:40:33 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11338/#p11338</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11317/#p11317</link>
			<description><![CDATA[<p>Yeah, sure, you&#039;ve got to add the line:<br />list($faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result);<br />inside the while loop. Otherwise, the variables don&#039;t get updated.</p>]]></description>
			<author><![CDATA[null@example.com (MarcB)]]></author>
			<pubDate>Wed, 17 Mar 2004 06:54:21 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11317/#p11317</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11312/#p11312</link>
			<description><![CDATA[<p>updated the code again... now I don&#039;t get the error!</p><p>Unfortunately, now I get the first row (record) of the db table three times...! and nothing else.&nbsp; There are three other rows in the db table. </p><p>Hmmm.&nbsp; I really don&#039;t get how the loop works, etc. so I&#039;m kinda taking shots in the dark.&nbsp; As it is now, the loop part is transplanted from viewforum.php. while the tables themselves are from help.php</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Wed, 17 Mar 2004 01:55:21 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11312/#p11312</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11311/#p11311</link>
			<description><![CDATA[<p>Thanks Rickard!!&nbsp; I added that snippet and now I get a &#039;Bad Request&#039; error which I&#039;ve determined originates from the if statement immediately following the $result query.&nbsp; Any ideas?</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Wed, 17 Mar 2004 01:17:18 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11311/#p11311</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11308/#p11308</link>
			<description><![CDATA[<p>PHP has no idea what $id is. You have to fetch the variable from $_GET and make sure it&#039;s an integer. Have a look at the other scripts (e.g. viewforum.php) to see how PunBB does it.</p>]]></description>
			<author><![CDATA[null@example.com (Rickard)]]></author>
			<pubDate>Tue, 16 Mar 2004 21:03:03 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11308/#p11308</guid>
		</item>
		<item>
			<title><![CDATA[Re: FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/11304/#p11304</link>
			<description><![CDATA[<p>So I&#039;ve been workin gon this FAQ thing...&nbsp; I have the DB stuff done... I created a table called &#039;faq&#039; with the following fields: id, question, answer, disp_position.<br />The FAQ Admin panel allows add/delete/edit (almost bug-free) so the DB side works.&nbsp; I&#039;m having trouble, though, with faq.php.<br />The code for faq.php is below...&nbsp; i get an error on the &#039;$result&#039; line...&nbsp; I really have no idea how this is supposed to work... if anyone has the time to take a look, I&#039;d appreciate it!<br /></p><div class="codebox"><pre><code>$pun_root = &#039;./&#039;;
require $pun_root.&#039;include/common.php&#039;;

//$id = intval($_GET[&#039;id&#039;]);
//if (empty($id) || $id &lt; 0)
//    message($lang_common[&#039;Bad request&#039;]);


// Load the faq.php language file
require $pun_root.&#039;lang/&#039;.$language.&#039;/&#039;.$language.&#039;_faq.php&#039;;





$page_title = pun_htmlspecialchars($pun_config[&#039;o_board_title&#039;]).&#039; / &#039;.$lang_faq[&#039;faq&#039;];
require $pun_root.&#039;header.php&#039;;

?&gt;
&lt;table class=&quot;punspacer&quot; cellspacing=&quot;1&quot; cellpadding=&quot;4&quot;&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;&lt;a href=&quot;index.php&quot;&gt;&lt;?php echo pun_htmlspecialchars($pun_config[&#039;o_board_title&#039;]) ?&gt;&lt;/a&gt; / &lt;?php echo $lang_faq[&#039;long_faq&#039;] ?&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;table class=&quot;punmain&quot; cellspacing=&quot;1&quot; cellpadding=&quot;4&quot;&gt;
    &lt;tr class=&quot;punhead&quot;&gt;
        &lt;td class=&quot;punhead&quot; colspan=&quot;2&quot;&gt;&lt;b&gt;Question not answered here? Post your question to the &lt;a href=&quot;viewtopic.php?pid=112#112&quot;&gt;FAQ Topic.&lt;/a&gt;&lt;/b&gt;&lt;/td&gt;
    &lt;/tr&gt;
&lt;?php

// Fetch some info from the faq
$result = $db-&gt;query(&#039;SELECT faq_name, question, answer, disp_position FROM &#039;.$db-&gt;prefix.&#039;faq ORDER BY disp_position&#039;) or error(&#039;Unable to fetch faq info&#039;, __FILE__, __LINE__, $db-&gt;error());
if (!$db-&gt;num_rows($result))
    message($lang_common[&#039;Bad request&#039;], true);

list($faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result);


if ($db-&gt;num_rows($result))
{
    while ($id = $db-&gt;fetch_assoc($result))
    {
    list($faq_name, $question, $answer, $disp_position) = $db-&gt;fetch_row($result);
?&gt;    

    &lt;tr&gt;
        &lt;td class=&quot;puncon1&quot; style=&quot;width: 240px; vertical-align: top&quot; &gt;&lt;p style=&quot;margin-bottom: 0&quot;&gt;&lt;b&gt;&lt;?php echo $lang_faq[&#039;question&#039;].$disp_position.&#039;&lt;/p&gt;&lt;p style=&quot;margin-left: 10px; margin-top: 5px; margin-bottom: 5px&quot;&gt;&lt;/b&gt;&#039;.$question ?&gt;&lt;/p&gt;&lt;/td&gt;
        &lt;td class=&quot;puncon2&quot; style=&quot;vertical-align: top&quot;&gt;&lt;p style=&quot;margin-bottom: 0&quot;&gt;&lt;b&gt;&lt;?php echo $lang_faq[&#039;answer&#039;].&#039;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 10px; margin-top: 5px; margin-bottom: 5px&quot;&gt;&#039;.$answer ?&gt;&lt;/p&gt;&lt;/td&gt;
    &lt;/tr&gt;

&lt;?php    
    }
}
else    
    echo &quot;\t&quot;.&#039;&lt;tr&gt;&lt;td class=&quot;puncon1&quot; colspan=&quot;6&quot;&gt;&#039;.$lang_faq[&#039;Empty FAQ&#039;].&#039;&lt;/td&gt;&lt;/tr&gt;&#039;.&quot;\n&quot;;

?&gt;       
&lt;/table&gt;

&lt;table class=&quot;punspacer&quot; cellspacing=&quot;1&quot; cellpadding=&quot;4&quot;&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;?php

require $pun_root.&#039;footer.php&#039;;</code></pre></div><p>edit: updated code</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Tue, 16 Mar 2004 18:53:08 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/11304/#p11304</guid>
		</item>
		<item>
			<title><![CDATA[FAQ Mod?]]></title>
			<link>https://punbb.informer.com/forums/post/10923/#p10923</link>
			<description><![CDATA[<p>I really like PunBB but was srprised that there was no FAQ for users.&nbsp; It would be nice to have an admin-able FAQ with a link in the header.&nbsp; The admin should be able to add custom Q &amp; A along with standard PunBB questions.</p><p>I would do this if I had a clue how...&nbsp; right now I&#039;m limited cut&amp;paste programming. <img src="https://punbb.informer.com/forums/img/smilies/sad.png" width="15" height="15" alt="sad" /></p><p>Thanks</p>]]></description>
			<author><![CDATA[null@example.com (Cailean)]]></author>
			<pubDate>Wed, 03 Mar 2004 20:29:02 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/10923/#p10923</guid>
		</item>
	</channel>
</rss>
