learner2006
03-06-2007, 08:32 PM
HEllo,
I am stuck in making a code work, and I need some help,
if you can help, it is appreciated,
this is a simple count code, it count some data from a file called data.csv
then it will print one line of data when the script is called,
it works fine and not a problem,
the only issue, because after printing is done the code will be sets to zero, the next time when script is called, the data will be from the beginning of the data.csv file, so always the data that is pulled and printed are same,
data.csv contains lots of data, which seperated by %%
I want all the data be printed ( not all at once) and when there is no data left then goes to the first one, which i think there is a need for memory or something,
or at least make it random, and make sure all data will be printed.
it does not matter which way,
here is part of the code that works:
$count = $oldcount = $totalcount = $tally = 0;
$data = file_get_contents("data.csv");
$data = explode('%%', $data);
$di = 0;
$printme .= "\n" . $data[$di++];
if($di>=count($data))$di=0;
$tally = 0;
}
}
$totalcount += $count;
}
}
echo $printme;
}
?>
appreciate your help
I am stuck in making a code work, and I need some help,
if you can help, it is appreciated,
this is a simple count code, it count some data from a file called data.csv
then it will print one line of data when the script is called,
it works fine and not a problem,
the only issue, because after printing is done the code will be sets to zero, the next time when script is called, the data will be from the beginning of the data.csv file, so always the data that is pulled and printed are same,
data.csv contains lots of data, which seperated by %%
I want all the data be printed ( not all at once) and when there is no data left then goes to the first one, which i think there is a need for memory or something,
or at least make it random, and make sure all data will be printed.
it does not matter which way,
here is part of the code that works:
$count = $oldcount = $totalcount = $tally = 0;
$data = file_get_contents("data.csv");
$data = explode('%%', $data);
$di = 0;
$printme .= "\n" . $data[$di++];
if($di>=count($data))$di=0;
$tally = 0;
}
}
$totalcount += $count;
}
}
echo $printme;
}
?>
appreciate your help