I have never dealt with PHP until now and could really use some help. There is several things I need to make happen before it's usable, but will focus on one things right now.
I am getting the following error:
Warning: Missing argument 1 for total_district_bill(), called in C:\xampp\htdocs\mtg\report.php on line 26 and defined in C:\xampp\htdocs\mtg\functions.php on line 38
Notice: Undefined variable: district2 in C:\xampp\htdocs\mtg\functions.php on line 40
FPDF error: Some data has already been output, can't send PDF file
I have already done something similar, but running into issues now for some reason. I need to display the count by a district number who brought their bill. Basically something like this:
$sql = "SELECT COUNT(*) FROM all_records
WHERE BI_VOTING_DIST_CD='$district' AND Brought_Bill='YES'";
This is what I got so far:
<?php
//Total count of all members
function total_members() {
$sql = "SELECT COUNT(*) FROM all_records";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
return '<span class="totals"><b>'.$row['COUNT(*)'].'</b> Members Registered</span><br />';
}
//Total count of all registered members
function total_registered() {
$sql = "SELECT COUNT(*) FROM all_records WHERE Is_Registered='1'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
return '<br /><br /><span class="totals"><b>'.$row['COUNT(*)'].'</b>/</span>';
}
//Function to count registered by district
//Pass district number and board member last name
function total_district($district, $name) {
$sql = "SELECT COUNT(*) FROM all_records WHERE BI_VOTING_DIST_CD='$district' AND Is_Registered='1'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
return '<tr><td>'.$district.' - '.$name.'</td><td> <b>'.$row['COUNT(*)'].'</b></td>';
}
//Function to count registered by district who brought bill
function total_district_bill($district2) {
$sql = "SELECT COUNT(*) FROM all_records WHERE BI_VOTING_DIST_CD='$district2' AND Is_Registered='1'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
return '<tr><td>/td><td> <b>'.$row['COUNT(*)'].'</b></td>';
//$sql = "SELECT COUNT(*) FROM all_records WHERE BI_VOTING_DIST_CD='$district' AND Brought_Bill='YES'";
//$result = mysql_query($sql);
//$row = mysql_fetch_array($result);
//return '<tr><td>'.$district.' - '.$name.'</td><td> <b>'.$row['COUNT(*)'].'</b></td>';
}
//Total count of all registered members' meals
function total_Brought_Bill() {
$sql = "SELECT SUM(Brought_Bill) FROM all_records WHERE Is_Registered='1'";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
return '<br /><br /><span class="totals"><b>'.$row['0'].'</b>/</span>';
//return '<span class="totals">Total Who Brought Bill: <b>'.$row[0].'</b></span>';
}
//total count of all notes entered, registered or not. This is also the indication of how much work you will have to do the next day :D
function total_notes() {
$sql = "SELECT COUNT(notes) FROM all_records WHERE Is_Registered=1";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
return '<br /><span class="totals">Total Notes: <b>'.$row['COUNT(notes)'].'</b></span><br />';
}
//return value from coop information DB
function coop_info($column) {
$sql = "SELECT $column FROM coop LIMIT 1";
$result = mysql_query($sql) or trigger_error(mysql_error().$sql);
$row = mysql_fetch_array($result);
return $row[$column];
}
function ticketCheck($voucher){
$sql = "SELECT COUNT(*) FROM all_records WHERE voucher='$voucher'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
return $row['COUNT(*)'];
}
//TEST
//function total_Brought_Bill() {
//$sql = "SELECT SUM(Brought_Bill) FROM all_records WHERE Is_Registered='1'";
//$result = mysql_query($sql);
//$row = mysql_fetch_row($result);
//return '<br /><br /><span class="totals"><b>'.$row['0'].'</b>/</span>';
//return '<span class="totals">Total Who Brought Bill: <b>'.$row[0].'</b></span>';
//}
?>