Jump to content


Photo

problem with inserting from text file arrays


  • Please log in to reply
1 reply to this topic

#1 obyno

obyno
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 25 March 2003 - 06:23 PM

trying to insert from three text files of 1000 tab delimited lines into db lets me go only as far as 255 rows and no further each time.And then of these a select query comes up blank via an html form page.Please what could be the prob.Anyone help?


I need to have the insertions done like - have the first element of the phonenumber.txt file inserted under phonenumber column, then have the first element of the name.txt file go into the name column of db, then the address column go in after it;then have this repeated row row for the three files until all the data has been inserted.When I do it all in one insert statement nested in foreach statements i receivemultiples of each elment for...really hope you can help.Thanks for caring



<?
include \"db.php\";

$nu = @fopen(\"phonenumber.txt\", \"r\")
or die(\"<br>Failed to open file: <i>phonenumber.txt</i>.\");
$array = file(\"phonenumber.txt\");


$nu = @fopen(\"userlist.txt\", \"r\")
or die(\"<br>Failed to open file: <i>userlist.txt</i>.\");
$array1 = file(\"userlist.txt\");


$nu = @fopen(\"password.txt\", \"r\")
or die(\"<br>Failed to open file: <i>password.txt</i>.\");
$array2 = file(\"password.txt\");


for ($i=0; $i<count($array); $i++)
{
$myquery = \"INSERT into totalled (phoneNumber, user, password) VALUEs (\'$array[$i]\', \'$array1[$i]\', \'$array2[$i]\')\";
$result = mysql_query($myquery, $ok);
if (!$result)
{
echo \"Nothing\";
}
}

?>

#2 obyno

obyno
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 26 March 2003 - 07:34 AM

Please somebody, please!!!! :cry: :cry: :cry:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users