Difference between revisions of "Edna duma"

From Ilianko
 
Line 72: Line 72:
 
<input type="submit" value="Submit" />
 
<input type="submit" value="Submit" />
 
</form>
 
</form>
 +
 +
</pre>
 +
  
 
[[Category:ММС]]
 
[[Category:ММС]]

Latest revision as of 15:20, 14 October 2011


<?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'].'<br>';

     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'].'<br />'; 
  
  $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'].'<br />'; 
  }
              
}

?>
<input type="submit" value="Submit" />
</form>