<?Php
$mod="select * from modul";
$result=mysql_query($mod);
while($lign=mysql_fetch_array($result)){
?>
<a href="inscription.php?ref_mod=<?Php print($lign['ref_mod']);?>&them_mod=<?Php print($lign['them_mod'])?>&date_mod=<?Php print($lign['date_mod']);?>"><?Php print($lign['them_mod'])?></a>
<?Php }?>
<?php
$ref_mod=$_GET['ref_mod'];
$them_mod=$_GET['them_mod'];
$date_mod=$_GET['date_mod'];
?>
<?php
$ref=$_POST['ref'];
$nom=$_POST['nom'];
$prenom=$_POST['prenom'];
$ville=$_POST['ville'];
$ref_mod=$_POST['ref_mod'];
$them_mod=$_POST['them_mod'];
$date_mod=$_POST['date_mod'];
$query=mysql_query("INSERT INTO `inscrits` ( `ref` , `nom` , `prenom` , `ville` , `ref_mod` , `them_mod` , `date_mod` ) VALUES ('$ref', '$nom', '$prenom', '$ville', '$ref_mod', '$them_mod', '$date_mod')");
$result = mysql_query($query);
?>
SELECT COUNT(ref) as NB FROM inscrits WHERE ref_mod = '$ref_mod'
$conf="select * from conference";
$result=mysql_query($conf);
while($lign=mysql_fetch_array($result))
{
$inscrits="SELECT COUNT(ref) AS NB FROM inscrits WHERE ref_conf = ".$lign['ref_conf'];
$result2=mysql_query($inscrits);
$lign2=mysql_fetch_array($result2);
if ($lign2['NB']<40)
{
print '<a href=\"ver_for.php?ref_conf='.$lign['ref_conf'];
print '&them_conf='.$lign['them_conf'];
print '&date_conf='.$lign['date_conf'];
print '">';
print $lign['them_conf']."</a><br>";
}
}
if (!$result) {
die('Requête invalide : ' . mysql_error());
}
print_rpar exemple, tu pourras contrôler tes résultats.
$omsql = mysqli_connect('0.0.0.0','user', 'pass');
$req="select conference.ref_conf , conference.them_conf , conference.date_conf \n";
$req = $req . "from conference \n";
$req = $req . "JOIN inscrits on inscrits.ref_conf = conference.ref_conf \n";
$req = $req . "GROUP BY conference.ref_conf , conference.them_conf , conference.date_conf\n";
$req = $req . "HAVING COUNT(inscrits.ref) < 40";
foreach ( $omsql->query($req) as $row ) {
print '<a href=\"ver_for.php?ref_conf='.$row['ref_conf'];
print '&them_conf='.$row['them_conf'];
print '&date_conf='.$row['date_conf'];
print '">';
print $row['them_conf']."</a><br>";
}
$conf="select * from conference"; $result=mysql_query($conf); while($lign=mysql_fetch_array($result)) { $inscrits="SELECT COUNT(ref_conf) AS NB FROM inscrits WHERE ref_conf =".$lign['ref_conf']; $result2=mysql_query($inscrits); $lign2=mysql_fetch_array($result2); if ($lign2['NB']<40) { print '<a href="ver_for.php?ref_conf='.$lign['ref_conf']; print '&them_conf='.$lign['them_conf']; print '&date_conf='.$lign['date_conf']; print '">'; print $lign['them_conf']."</a><br>"; } }