Edna duma
From Ilianko
<?php $con = mysql_connect('localhost', 'root', '3403a'); mysql_select_db("test", $con); $tochki = 0; if($_GET) { $result = mysql_query('SELECT * FROM `vyprosi` WHERE `status` = 1'); while($row = mysql_fetch_assoc($result)) { $query = 'SELECT * FROM `otgovori` WHERE id_vyprosi='.$row['id'].' AND status = 1'; $result2= mysql_query($query); $otgovor = mysql_fetch_assoc($result2); print $_GET[$row['id']].' == '.$otgovor['id'].'
'; if ( $_GET[$row['id']] == $otgovor['id']) { $tochki++; } } print $tochki; exit(); } ?> <form name="input" action="" method="get"> <?php $result = mysql_query('SELECT * FROM `vyprosi` WHERE `status` = 1 ORDER BY RAND()'); $i=1; while($row = mysql_fetch_assoc($result)) { print $i++.$row['vypros'].'
'; $query = 'SELECT * FROM `otgovori` WHERE id_vyprosi='.$row['id'].' ORDER BY RAND()'; $result2 = mysql_query($query); while($row1 = mysql_fetch_assoc($result2)) { print '<input type="radio" name="'.$row['id'].'" value="'.$row1['id'].'" />'; print $row1['otgovor'].'
'; } } ?> <input type="submit" value="Submit" /> </form>