I have two table of same data. First table is written by the admin and the second data is written by the user. Now I want to compare these two and see if they match, if not then the correct data is displayed.
So far I am retrieving the user's current details and now I would like to compare this with the admin, but stuck. Can someone help me.
the two table format :
Admin table
Que_ID
Que_Answe1
Que_Answer2
Que_Answer3
Que_Answer4
User table
Que_ID
Ans_Answer1
Ans_Answer2
Ans_Answer3
Ans_Answer4
The code to retrieve user table is
<?php
$intNumber = 1;
$sql=correctanswer($_SESSION['username1'], $_SESSION['smodule']);
while($info = mysql_fetch_array( $sql )) {
echo " $intNumber, {$info['Que_Question']} <br />\n";
if($info['Ans_Answer1'] == '1') {
echo "<input type=\"checkbox\" name=\"choice1[]\" value='1'\" checked> ";
echo "{$info['Que_Choice1']} <br />\n";
}
else {
echo "<input type=\"checkbox\" name=\"choice1[]\" value=\" {$info['Que_Choice1']}\" /> ";
echo "{$info['Que_Choice1']} <br />\n";
}
if($info['Ans_Answer2'] == '1') {
echo "<input type=\"checkbox\" name=\"choice2[]\" value='1'\" checked> ";
echo "{$info['Que_Choice2']} <br />\n";
}
else {
echo "<input type=\"checkbox\" name=\"choice2[]\" value=\" {$info['Que_Choice2']}\" /> ";
echo "{$info['Que_Choice2']} <br />\n";
}
if($info['Ans_Answer3'] == '1') {
echo "<input type=\"checkbox\" name=\"choice3[]\" value='1'\" checked> ";
echo "{$info['Que_Choice3']} <br />\n";
}
else {
echo "<input type=\"checkbox\" name=\"choice3[]\" value=\" {$info['Que_Choice3']}\" /> ";
echo "{$info['Que_Choice3']} <br />\n";
}
if($info['Ans_Answer4'] == '1') {
echo "<input type=\"checkbox\" name=\"choice4[]\" value='1'\" checked> ";
echo "{$info['Que_Choice4']} <br />\n";
}
else {
echo "<input type=\"checkbox\" name=\"choice4[]\" value=\" {$info['Que_Choice4']}\" /> ";
echo "{$info['Que_Choice4']} <br />\n";
}
$intNumber++;
}
?>