Jump to content

[SOLVED] file() expects parameter 2 to be long, error after upgrade to PHP5


rubing

Recommended Posts

I searched around for answer but had too much noise from webpages with similar errors. 

 

After upgrading to PHP5 I am now getting these errors:

 

Warning: file() expects parameter 2 to be long, string given in /home/rubing/public_html/textpro2.php on line 19

 

Warning: Invalid argument supplied for foreach() in /home/rubing/public_html/textpro2.php on line 20

 

Appreciate some help!!

 

Here is my php source:

 

<?php

include 'config.inc';

include 'opendb.inc';

 

$lines = file("BHAM.txt", "r");  //  LINE 19

foreach($lines as $single_line) //  LINE 20

 

{

$value_arr = explode("\t", $single_line);

 

if (empty($value_arr[1])) {

$DATE = $value_arr[0] ; 

}

$var1=$value_arr[0];

$var2=$value_arr[1];

 

$vara=html_entity_decode($var1);

$varb=html_entity_decode($var2);

 

$band = trim($vara);

$venue = trim($varb);

 

$query = "INSERT INTO test (BAND, VENUE,DATES) VALUES ('$band', '$venue','$DATE' )";

$sql = mysql_query($query);

}

 

mysql_close($conn);

 

?>

You're Great Man! Thanks.

 

The "R" means Read, it worked fine in the last version.  I was thinking that maybe the syntax for the parameter changed or something, but couldn't find anything on it.  Yeah, I should've just tried to remove it in retrospect, but just figured it was an important parameter.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.