Warning: mysql_field_name(): Field 19 is invalid for MySQL result index 4 in /home/ekk-lexo/public_html/php/donations/download.php on line 18.
BTW - Field 19 is the last field in the search query and the above error will show up for every row in the found query. Data, however, comes through OK but I have all these errors listed as well.
Line 18 contains the following php code:
Code: Select all
$header .= mysql_field_name($rs_D, $i) . "\t";Code: Select all
<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=donations.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<?php require_once('../../Connections/Ekklesia.php'); ?>
<?php
mysql_select_db($database_Ekklesia, $Ekklesia);
$query_rs_D = "SELECT donations.donor, donations.giftDate, donations.type, donations.checkNum, donations.genFund, donations.misFund, donations.benFund, donations.notes, oikos.id, oikos.company, oikos.salutation, oikos.family, oikos.greeting, oikos.famLabel, oikos.address, oikos.city, oikos.st, oikos.zip, oikos.household FROM donations, oikos WHERE (donations.donor = oikos.id) AND (donations.giftDate > '2002-12-31') AND (donations.giftDate < '2004-01-01')";
$rs_D = mysql_query($query_rs_D, $Ekklesia) or die(mysql_error());
$row_rs_D = mysql_fetch_assoc($rs_D);
$totalRows_rs_D = mysql_num_rows($rs_D);
?>
<?php
for ($i = 0; $i < $totalRows_rs_D; $i++)
{
$header .= mysql_field_name($rs_D, $i) . "\t";
}
?>
<?php
while ($row = mysql_fetch_row($rs_D))
{
$line = '';
foreach($row as $value)
{
if ((!isset($value)) OR ($value == ""))
{
$value = "\t";
}
else
{
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data .= trim($line)."\n";
}
$data = str_replace("\r","",$data);
?>
<?php if ($data == "") {$data = "\n(0) Records Found!\n";} ?>
<?php
print "$header\n$data";
?>
<?php
mysql_free_result($rs_D);
?>