you made me test it and it works just as i said. the insert query is inside a while loop so it going to loop and insert all the lines in the text file.
1) make a table called products:
CREATE TABLE `products` (
`id` int(10) unsigned NOT NULL default '0',
`item` varchar(50) NOT NULL default '',
`price` varchar(20) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
2) create a text file called file.txt with:
123 || keyboard || $20.00
456 || speakers || $45.00
3) create a php file and add to it:
$fp = fopen ('/home/public_html/file.txt', 'r');
while (!feof ($fp))
{
$seperate = explode('||', str_replace(' ', '' , fgets($fp, 4096)));
mysql_query("INSERT INTO products (id, item, price) VALUES ('".$seperate[0]."', '".$seperate[1]."', '".$seperate[2]."')");
}
fclose ($fp);
4) Change the path above to the full path to the file.txt
5) save everything and upload, now run the php file via browser and check your database table.. you should see two rows.