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);

 

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.