# Php script debug

**URL:** <https://forum.kirupa.com/t/php-script-debug/9129>\
**Category:** Uncategorized\
**Created:** [December 5, 2002, 2:37pm UTC](https://forum.kirupa.com/t/php-script-debug/9129 "2002-12-05T14:37:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jubba](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@Jubba](https://forum.kirupa.com/u/Jubba)\
**Post date:** [December 5, 2002, 2:37pm UTC](https://forum.kirupa.com/t/php-script-debug/9129/1 "2002-12-05T14:37:08Z")

</div>

```php

<?
if ($correct == "Yes") {
     $filename = "shout.txt";
     $fp = fopen( $filename,"r"); 
     $OldData = fread($fp, 80000); 
     fclose($fp); 
     	
     $Input = "Name: <b>$nName</b><br>Email: <b><u><a href=\"mailto:$nEmail\">$Email</a></b></u><br>Message: <b>$nMess</b><br>.:::.";

     $New = "$Input$OldData";
	
     $fp = fopen( $filename,"w"); 
     fwrite($fp, $New);
     fclose($fp); 
}
$filename = "shout.txt";
$fp = fopen($filename,"r"); 
$Data = fread($fp, 80000); 
fclose($fp);
	
$DataArray = split (".:::.", $Data);
$NumEntries = count($DataArray) - 1;
print "&TotalEntries=$NumEntries&nLow=$nLow&nHigh=$nHigh&GuestBook=";
for ($n = $nLow; $n < $nHigh; $n++) {
print $DataArray[$n];
     if (!$DataArray[$n]) {
          Print "<br><br><b>No More entries</b>";
          exit;
          }
     }
?>

```

I don’t get any errors, but for some reason it will not write to the textfile… Anybody want to take a swing at it?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 5, 2002, 2:42pm UTC](https://forum.kirupa.com/t/php-script-debug/9129/2 "2002-12-05T14:42:20Z")

</div>

oh, and the txt file is writeable. I have another script to check that and that script writes to the file fine…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 5, 2002, 5:45pm UTC](https://forum.kirupa.com/t/php-script-debug/9129/3 "2002-12-05T17:45:22Z")

</div>

I think I got it 🙂
