RE: [PHP] Where's the error?
| From: | David Freeman | Date: | Tue, 14 May 2002 12:54:04 +0000 |
| Subject: | RE: [PHP] Where's the error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97527@lists.php.net to get a copy of this message | ||
> Thanks heaps for your help I really appreciate it. I have
> made the changes you suggested but now I only get a blank screen.
These are more general hints on ways to solve the problem yourself.
> function getmydate($hit)
> {
> $single = explode (" ",$hit);
> return $single[3].$single[4];
> }
What happens if you feed this function a designated string that you
explicitly provide. ie. Define $string to be a line of data you'd like
get date info on and then call the function. If you get the right thing
you know your function is doing what you expected.
> $filename = ("combined_log");
>
> //fopen ($filename, "r");
>
> $fcontents = file($filename);
> $limit = 1;
> for ($i = 0; $i <= $limit; $i++)
> {
> $line = $fcontents[i];
Try echo'ing $line to make sure you actually had something happen.
> if (!empty($line))
> {
> $currentdate = getmydate($line);
> echo $currentdate;
> }
> }
Work up to the whole solution if you find things not working like you'd
expect.
CYA, Dave