forked from if-itb/IF3110-2015-T1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestionSingleReq.php
29 lines (26 loc) · 1021 Bytes
/
questionSingleReq.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include("singlequestionDiv.php");
$db_con = mysql_connect("localhost", "root");
if (!$db_con){
die('Could not connect: '.mysql_error());
}
mysql_select_db("stackexchange", $db_con);
$query = "SELECT * FROM question_list WHERE qid=" . $_GET["qid"];
$result = mysql_query($query);
if(mysql_num_rows($result) > 0) {
while($row = mysql_fetch_assoc($result)) {
$echoQuestion = $singlequestionDiv;
$echoQuestion = str_replace("qid", $row["qid"], $echoQuestion);
$echoQuestion = str_replace("{name}", $row["name"], $echoQuestion);
$echoQuestion = str_replace("{topic}", $row["topic"], $echoQuestion);
$echoQuestion = str_replace("{content}", $row["question"], $echoQuestion);
$echoQuestion = str_replace("{answer}", $row["answer"], $echoQuestion);
$echoQuestion = str_replace("{votes}", $row["vote"], $echoQuestion);
$echoQuestion = str_replace("{datetime}", $row["date_time"], $echoQuestion);
echo $echoQuestion;
}
}
else{
echo "No Question"; }
mysql_close($db_con);
?>