Jump to content

problem with inserting from text file arrays


Recommended Posts

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\";

}

}

 

?>

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.