Help with PHP error Warning: file() ?

  • Thread starter Thread starter Jury108
  • Start date Start date
J

Jury108

Guest
Warning: file() expects parameter 2 to be long, string given in /Library/WebServer/Documents/guestbook.php/output.php on line 16

from the code

<?php
//Get vars
//The setting 'track_vars' must be "ON" (standard).
$new_comment_array=$HTTP_POST_VARS;
$user_data=file("data.txt", "r");

//New Comment?
if($new_comment_array["new_entry"]=="true")
{
//Prove "Is 'text' filled"
if($new_comment_array["comment"]=="")
{
die("You have to fill the textfield!");
}

//Saving new comment
if($new_comment_array!="")
 
I think I might miss off parameter 2 altogether. You seem to be confusing the command with fopen.

$user_data=file("data.txt");

If you need parameters for file they would look something like this
FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES
 
Back
Top