Jump to content

cannot use mysql_fetch_assoc twice :S


stijn0713

Recommended Posts

I need it in the following code:

 

f($pad == 1){
$query = "SELECT * FROM groepen WHERE groep_id = $groep_ID";
$rs = mysql_query($query);
$row_groep = mysql_fetch_array($rs);
mysql_free_result($rs);
}

if($pad == 2) {
$query = "SELECT * FROM groepen WHERE onderzoek_id = $onderzoek_ID";
$rs = mysql_query($query);
$aantal_groepen = mysql_num_rows($rs); 
}

 

 

if ($pad == 2){
/// bepaal extra kenmerken van de groep:
foreach ($_SESSION as $key => $value){

if(is_array($value)) { foreach($value as $k => $v){

	if($_SESSION['gekozen_groep'] == $k) {

		$groep_locatie = $_SESSION['groep_locatie'][$k];
		$groep_onderwerp = $_SESSION['groep_onderwerp'][$k];
		$groep_afloop = $_SESSION['groep_afloop'][$k];

		}}}}}

if ($pad == 1){

$groep_locatie = $row_groep['groep_locatie_id'];
$groep_onderwerp = $row_groep['groep_name'];
$groep_afloop = $row_groep['groep_tijdstip'];
} 

 

 

 

<select name="selecteerGroep" id="selecteerGroep" size ="<?php ($pad == 2) ? $aantal_groepen : '1' ?>" />
	 <?php while ($row = mysql_fetch_assoc($rs)) { 

	 echo '<option value="'.$row['groep_id'].'">'.$row['groep_name'].'</option>';

	 }  ?>     
        </select>

.

 

 

So what am i trying to do:

 

-one can create an examination

-one can create several groups that belong to an examination

- one can add respondants to an examination

 

Either the admin create and add respondants in an sequencial way :: 1) create examination 2) create group(s) 3) add respondants..  --> parameters are passed via $_SESSION.

 

OR the admin selects an examination from the list and adds people --> parameters are passed via querystring.

 

The above code with the selector echoes either the groups created with the sequencial way or it echoes the group (only one) passed via the querystring. 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.