$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="ques"; // Table name
$con = mysql_connect("$host","$username")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$quesid=$_POST['quesID'];
$question =$_POST['questions'];
if ($quesid <> "")
{
$sql = "SELECT * FROM $tbl_name WHERE quesID = '$quesid'";
while($result= mysql_fetch_assoc($sql))
{
$quesi = $result['quesID'];
$ques = $result['ques'];
$op1 = $result['op1'];
$op2 = $result['op2'];
$op3 = $result['op3'];
$op4 = $result['op4'];
$exans = $result['exans'];
}
}
else
{
$sql = "SELECT * FROM $tbl_name WHERE questions='$question'";
while($result= mysql_fetch_assoc($sql))
{
$quesi = $result['quesID'];
$ques = $result['ques'];
$op1 = $result['op1'];
$op2 = $result['op2'];
$op3 = $result['op3'];
$op4 = $result['op4'];
$exans = $result['exans'];
}
}
?>
| Question ID : | " /> |
| Question : | " /> |
| Option 1 : | " /> |
| Option 2 : | " /> |
| Option 3 : | " /> |
| Option 4 : | " /> |
| Right Answer : | " /> |
data doesn\t display in textbox..plz give solution
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sharad GuptaPosted Feb 18, 2014, 5:03 AM
shah varshil,
see given below link
http://www.c-sharpcorner.com/UploadFile/c63ec5/display-records-in-html-textboxes-in-php-script/