Hi all,
I have a few different query's from which I need to display the results.
Have a look at the code and you'll understand better then I can explain.
This is the relevant part, the counting query does work, tested it without variables.
How must I do this ??
Thanks !
Code:
I have a few different query's from which I need to display the results.
Have a look at the code and you'll understand better then I can explain.
This is the relevant part, the counting query does work, tested it without variables.
How must I do this ??
Thanks !
Code:
Code:
<?php
mysql_select_db($database_ASN, $ASN);
//These arrays will probably be bult from your database tables like
$w_naam = "";
$where = "";
$sql = 'SELECT Naam, Datum, plaats FROM wedstrijd WHERE(Year(`Datum`) = 2005)ORDER BY datum';
$result = mysql_query($sql, $ASN) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
$wedstrijdnaam[] = $row['Naam'];
$w_datum[] = $row['Datum'];
$w_plaats[] = $row['plaats'];
}
$sqlKlasse = 'SELECT * FROM klasse';
$Kresult = mysql_query($sqlKlasse, $ASN) or die(mysql_error());
while ($row = mysql_fetch_assoc($Kresult))
{
$Class[] = $row['Klasse'];
}
$Count = "SELECT DISTINCT COUNT(`inschrijving`.`DeelnemerId`) AS `Aantal deelnemers` FROM `wedstrijd` INNER JOIN `inschrijving` ON (`wedstrijd`.`Id` = `inschrijving`.`WedstrijdId`) INNER JOIN `deelnemer` ON (`inschrijving`.`DeelnemerId` = `deelnemer`.`Id`) where wedstrijd.Naam = ('$w_naam')";
$Countresult = mysql_query($Count, $ASN) or die(mysql_error());
if (true === isset($_POST['Search']))
{
$where_clause = '';
// handle search
if (true === isset($_POST['Naam']))
{
// Check for search by Wedstrijd
$w_naam = $_POST['Naam'];
if (0 < strlen($w_naam))
{
$where[] = ' Naam = \'' . $w_naam . '\'';
}
// check for search by genre
$g_name = $_POST['Klasse'];
if (0 < strlen($g_name))
{
$where[] = ' Klasse = \'' . $g_name . '\'';
}
if (true === is_array($where))
{
$where_clause = implode(' AND ', $where);
}
}
/*
build your query to search the appropriate talbe(s)
and add the $where_clasuse to it, something like */
?>
<center>
<b><strong><font size="6" color="#FFFFFF"><?php echo 'Uitslag van ' . $w_naam . ' ' . $g_name . ' Inschrijvingen: ' . $Countresult; ?></></font></strong></b>
<form name="fotoform" method="post" action="./<?php echo $w_naam ?>/pics/index.htm">
<input type="submit" name="Submit" value="Foto's">
</form>
</center>
<?php