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.
<?
$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.