Forum Moderators: coopster
I want to have a support knowledge base in my site.Does any one know how to get on with this? I have absolutely no clue about where to begin.
When my support home page loads, I want to load 5 questions from my database at random. These question will have to change every time the page reloads.
Here is what I am thinking of
index.php
----------------------------------------
<?php
include ("secure/DisplayRandomTips.php");
$displayRandomTips = new DisplayRandomTips();
$displayRandomTips->setQuestion();
$question = $displayRandomTips ->getQuestion();
$serial_number = $displayRandomTips ->getSerialnumber();
?>
<html><body>...
<a href="http://www.zipapplication.com/support/bin/answer?tag=<?php $serial_number ; ?>"><?php print $question; ?></a>
<body><html>
DisplayRandomTips.php
-------------------------------------------
class DisplayRandomTips {
var $question = "Null";
var $serial_number ="Null";
function setQuestion(){
include ("DBConnect.php");
$getData = "SELECT * FROM knowledge_base ORDER BY RANDOM()";
$getData2 = mysql_query($getData) or die("Could not query 5 column");
$getData3=mysql_fetch_array($getData2);
// Get serial_number and question from database
$this->question = $getData3['question'];
$this->serial_number = $getData3['serial_number'];
// Close mysql connection
mysql_close($con);
}
function getQuestion(){
return $this->question;
}
function getSerialnumber(){
return $this->serial_number;
}
}
I am also not sure, if this is the correct way of doing things. I was wondering is there any other better way to do this?
Thank you,
//excute the query and print results
}