View Single Post
  #4 (permalink)  
Old 09-13-03, 08:33 AM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
For this to work, just add a + in front of each line that contains data, like such:
-----------------------------------------------------
Copmany Name Price

+Exim Bank 100.00
+Standard Bank 120.00
-------------------------------------------------

PHP Code:

<?php


$prices 
file('price.txt');
for (
$i=0$i<count($prices); $i++)
{
      if (
stristr($prices[$i],'+'))
      {
            
$data explode(' ',$prices[$i]);
            
mysql_query("INSERT INTO table (name,price) VALUES ('$data[0]','$data[1]')");
      }
}

?>
Of course I don't know how your mysql table structure is but you can modify that query to your needs.
__________________
PHP / mySQL Developer
Reply With Quote