Click to See Complete Forum and Search --> : Form doubling output


ephmynus
07-30-2004, 09:04 AM
Okay, I've got a search going so that users can search through requests that were inputted previously by a date range. Everything was working fine but I tried July 1st-30th today and it doubled up the output I received. It also did this for the second. The third and beyond is fine though. Any ideas.


<?
$uniquenum=$_POST['uniquenumber'];
$searchdaystart=$_POST['searchdaystart'];
$searchdayend=$_POST['searchdayend'];
$searchmonth=$_POST['searchmonth'];
$totaldays=$_POST['totaldays'];
$handle = fopen("search$uniquenum.txt", "x");
$writedata="Order,Line,Customer,Item,Wrong Item,Sent By,Date\n";

for($mycount=0;$mycount<=$totaldays;$mycount++)
{
$input = "$searchmonth $searchdaystart";
$myfile=file("shiperrors$searchmonth.txt");
$number=count($myfile);
$a=0;
$count=0;
for($i=0;$i<=$number;$i++){
$blah=strstr($myfile[$i],$input);
if($blah){
$next=str_replace(" "," ",$myfile[$i]);
$next=chop($next);
$a=$a+1;
$count=$count+1;
$writedata.="$next\n";
}
}
$searchdaystart += 1;
}
fwrite($handle, $writedata);
fclose($handle);
print "<a href='search$uniquenum.txt'>Your File</a>";
?>



I'll warn you that there are a few things I'll be adding later so some of these lines (such as replacing spaces with spaces) aren't in use currently. Totaldays comes over as the number of days to search overall.

ephmynus
07-31-2004, 10:52 AM
Anybody?

Stephen Philbin
07-31-2004, 01:15 PM
Maybe something went wrong with the entries of that specified range when you entered them into your database?

Have you manually checked that there aren't actually two copys of each bit of data within that range?

ephmynus
08-02-2004, 07:09 AM
Yes, I have checked the files this is pulling from and everything is fine with it. I've actually found at that it only happens if I select 1 or 2 as the start date. I just found out that it reaslly messes up on 1 and 2 also. I just selected 1 through 21 (and there are no entries for those dates) and it pulled everything for the month. However, I selected the 3rd through the 21st and it pulled nothing like it was supposed to.