|
Posted by PHP on 10/26/31 11:33
I have problem with showing my php code.
This is my code:
include("verbinding.php");
mysql_connect ("$dbhost","$username","$dbww");
mysql_select_db ("$db") or die ("Foutje");
$resultaat = mysql_query ("SELECT DISTINCT vragen.vraag_id,
vragen.vraag_omschrijving, antwoord_omschrijving, antwoord_code FROM
vragen,antwoorden WHERE vragen.vraag_id = antwoorden.vraag_id;");
$i=1;
while ($record = mysql_fetch_array($resultaat))
{
if($i==1)
{
$q="SELECT COUNT(vraag_id) FROM antwoorden WHERE
vraag_id=".$record[0];
$q_result=mysql_query($q);
$aantal=mysql_fetch_row($q_result);
echo "<br>$record[vraag_id].<br>";
echo "$record[vraag_omschrijving]<br>";
echo "{";
}
$antwoord_code="antwoord_code";
echo "$record[antwoord_omschrijving],";
if($i==$aantal[0])
{
$i=1;
}
else
$i++;
if ($record[$antwoord_code] == 1){
print (" =");
} else if ($record[$antwoord_code] == 0){
print (" ~"); echo "}";}}
?>
The result in HTML is:
1
vraag_1
{antwoord_1, =antwoord_2, ~antwoord_3, ~antwoord_4, ~
2
vraag_2
{antwoord_1, ~antwoord_2, =antwoord_3, ~antwoord_4, ~
But it has to be like this:
1
vraag_1
{=antwoord_1, ~antwoord_2, ~antwoord_3, ~antwoord_4}
Can anyone get it like above?
Navigation:
[Reply to this message]
|