Hi, my first post.
I'm trying to gather attendance records between two dates the user selects.
I have two tables 'attendance' and 'artists_details' which I'm hoping I've
successfully joined. The field I'm working on is just above the commented one
'ethnicity=maori'. I get no errors, however whatever dates I choose the number
returned is always 16,500 which is patently ridiculous. Any thoughts?
Regards Harrence
<?php
if ($logged_in=='true') { ?>
<table border="0">
<form name="date_picker" id="date_picker" method="post">
<tr><td><h4>Please choose a period of time between two dates</h4>
</td>
</tr>
<tr><td with="200" align="center">From:</td><td><a href="javascript:cal1.popup();"><input type="text" name="date1" value="" /></a>
</td>
</tr>
<tr><td with="200" align="center">To:</td><td><a href="javascript:cal2.popup();"><input type="text" name="date2" value="" /></a>
</td>
</tr>
</form>
</table>
<script type="text/javascript">var cal1 = new calendar1(document.forms['date_picker'].elements['date1']);
var cal2 = new calendar1(document.forms['date_picker'].elements['date2']);</script>
<form action="<?php echo $PHP_SELF; ?>" method="post" name="numbers" id="numbers">
<?php
$sql=mysql_query("SELECT artist_id FROM artists_details WHERE ethnicity='pacific islands'");
$num_rows_p = mysql_num_rows($sql);
$result=mysql_query("SELECT * FROM artists_details, attendance WHERE ethnicity='maori' AND date='record_id' BETWEEN 'date1' AND 'date2'");
$num_rows_m = mysql_num_rows($result);
//$result=mysql_query("SELECT artist_id FROM artists_details WHERE ethnicity='maori'");
//$num_rows_m = mysql_num_rows($result);
$result=mysql_query("SELECT artist_id FROM artists_details WHERE ethnicity='other'");
$num_rows_o = mysql_num_rows($result);
$result=mysql_query("SELECT artist_id FROM artists_details WHERE youth='youth'");
$num_rows_y = mysql_num_rows($result);
$result=mysql_query("SELECT artist_id FROM artists_details WHERE outreach='outreach'");
$num_rows_out = mysql_num_rows($result);
$result=mysql_query("SELECT artist_id FROM artists_details");
$num_rows_total = mysql_num_rows($result);
?>
<table style="border: 1px solid #000000;" name="numbers" width="150">
<tr><td>Pacific Islands</td><?php if (isset($_POST['submit'])){?><td><?php echo "$num_rows_p";}?></td></tr>
<tr><td>Maori</td><?php if (isset($_POST['submit'])){?><td><?php echo "$num_rows_m";}?></td></tr>
<tr><td>Other</td><?php if (isset($_POST['submit'])){?><td><?php echo "$num_rows_o";}?></td></tr>
<tr><td>Youth</td><?php if (isset($_POST['submit'])){?><td><?php echo "$num_rows_y";}?></td></tr>
<tr><td>Outreach</td><?php if (isset($_POST['submit'])){?><td><?php echo "$num_rows_out";}?></td></tr>
<tr><td>Total Numbers</td><?php if (isset($_POST['submit'])){?><td><?php echo "$num_rows_total";?></td></tr>
</table>
<?php
echo?><br /><a href="ksadmin.php">Back to admin</a>
<?php
}
?><br />
<?php
if (!isset($_POST['submit'])){ echo?>
<input type="submit" name="submit" value="Get Numbers" />
</form>
<?php
}
?>
<?php
}else{
echo "You are not authorised to view this page, please login or visit our home page";
?><br /><a href="login.php">Log in</a><br />
<a href="../index.html">Home</a>
<?php
}
?>