Read my last post below.
| SitePoint Sponsor |
Read my last post below.
Last edited by webhost; May 3, 2003 at 16:22.


whoa, that's hard on the brain
what you want is accomplished by sql alone
i don't understand why you are only querying the count() in your tables -- where's the query that actually returns the categories and answers?
also, how did you want to select the 10 to show -- lastest? random? alphabetical?
This is a file from modernbill faq which is inside modernbill. I have this also working as standalone outside modernbill, but I only want to show certain categories like pre sales questions and uploading files and such. The way it is now I have to show all of them on the page.
http://realwebhost.net/table.html


which questions and categories do you want to select?
http://www.realwebhost.net/faqs.php
categories 3,5,6,9,10,20 all questions under them


Code:select cname, ctype , question, answer, timestamp from categories inner join questions on categories.cid = questions.cid where categories.cid in (3,5,6,9,10,20)
Going different route here scraped that file and have 2 here getting closer but lost with the queries here they are.
faq_categoriesfaq_questionsPHP Code:<?php
$dbi= mysql_connect('localhost','user','pass');
mysql_select_db('dbname');
$sql_get_faq_categories_txt = "select cid,cname from faq_categories where cid IN (3,5,6,9,10,20)";
$sql_get_faq_categories = mysql_query($sql_get_faq_categories_txt,$dbi);
if (!$sql_get_faq_questions)
die ("Error displaying information. Please report this information to the administrator -- ".$sql_get_faq_categories_txt . " - " . mysql_error());
while(list($cid,$cname)=mysql_fetch_row($sql_get_faq_categories))
{
echo "<a href=""\"questions.php?cid=$cid\">$cname</a>";
}
?>
PHP Code:<?php
$dbi= mysql_connect('localhost','user','pass');
mysql_select_db('dbname');
$sql_get_faq_questions_txt = "select fid,cid,question,answer,timestamp from faq_questions";
$sql_get_faq_questions = mysql_query($sql_get_faq_questions_txt);
if (!$sql_get_faq_questions)
die ("Error displaying information. Please report this information to the administrator -- ".$sql_get_faq_questions_txt . " - " . mysql_error());
while(list($fid,$cid,$question,$answer,$timestamp)=mysql_fetch_row($sql_get_faq_questions))
{
// Display your information here
}
?>
Last edited by webhost; May 3, 2003 at 16:29.
Bookmarks