[insert_php]
$host=”db1152.perfora.net”; // Host name
$username=”dbo220623107″; // Mysql username
$password=”wBr7cFFV”; // Mysql password
$db_name=”db220623107″; // Database name
mysql_connect(“$host”, “$username”, “$password”)or die(“cannot connect to server”);
mysql_select_db(“$db_name”)or die(“cannot select database”);
if(is_null($_GET[“q”])) {
echo “
Frequently Asked Questions
“;
echo “
- “;
- $question
$result_faq=mysql_query(“SELECT * FROM faq ORDER BY id_num”);
$q_num = “1”;
// grab all the content
while($r=mysql_fetch_array($result_faq))
{
// the format is $variable = $r[“nameofmysqlcolumn”];
$id_num=$r[“id_num”];
$question=$r[“question”];
echo “
“;
$q_num++;
}
echo “
“;
}
else {
// GET
$id_num = $_GET[“q”];
echo “
Frequently Asked Questions
“;
$result_faq=mysql_query(“SELECT * FROM faq WHERE id_num = $id_num “);
// grab all the content
while($r=mysql_fetch_array($result_faq))
{
// the format is $variable = $r[“nameofmysqlcolumn”];
$question=$r[“question”];
$answer=$r[“answer”];
}
echo “
Question:
” . $question . “
“;
echo “
Answer:
” . $answer . “
“;
echo “
‹ back to frequently asked questions
“;
}
[/insert_php]