I have been trying to read the contents off three(3) text files comprising phonenumbers, names and addresses, and write them into a database table of three fields of similar names.I want to do the insertion so that each row will have an entry for phonenumbers, names and addresses.Except I keep getting the unwanted results with these codes.Can somebody please look and help urgently?Thanks.Appreciate.
The code I used:
<?php
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");
foreach ($array as $fd)
{
foreach ($array1 as $fg)
{
foreach ($array2 as $fx)
{
$myquery = "INSERT into totalled (phoneNumber, user, password) VALUEs ('$fd', '$fg', '$fx')";
$result = mysql_query($myquery, $ok);
if (!$result)
{
echo "Nothing";
}
}
}
}
?>
😕 😕