rubing Posted January 26, 2008 Share Posted January 26, 2008 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); ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted January 26, 2008 Share Posted January 26, 2008 Did you check php.net? http://us2.php.net/file What does "r" mean in your code? Quote Link to comment Share on other sites More sharing options...
rubing Posted January 26, 2008 Author Share Posted January 26, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.