I'm loading a csv text file into a table in a mysql database, however it
seems to just stop after a while if the file is to big.  For example if the
csv file is less than 10 megs I don't have a problem, however if it is more
it seems to to drop about half way thru the file.

here is the script I used

$fo = @fopen($datafile, "r") or die ("could not open $datafile");
while ($line = fgets ($fo,1024)) {

  $line = ereg_replace ("\'","",  $line);
  $line = ereg_replace ("\"","",  $line);

  list ($loannumber, $transactionnumber, $transactioncode, $subtype,
$investornumber, $transactiondate, $nextduedate, $principalbalance,
$escrowbalance, $principalamount, $interestamount, $escrowamount,
$suspenceamount, $transactionamount, $transactiondescription, $feesamount,
$subtotal, $code1, $amount1, $code2, $amount2, $end) = explode(",", $line);

  $query = "insert into $table
   (loannumber, transactionnumber, transactioncode, subtype, investornumber,
transactiondate, nextduedate, principalbalance, escrowbalance,
principalamount, interestamount, escrowamount, suspenceamount,
transactionamount, transactiondescription, feesamount, subtotal, code1,
amount1, code2, amount2, end)
   ('$loannumber', '$transactionnumber', '$transactioncode', '$subtype',
'$investornumber', '$transactiondate', '$nextduedate', '$principalbalance',
'$escrowbalance', '$principalamount', '$interestamount', '$escrowamount',
'$suspenceamount', '$transactionamount', '$transactiondescription',
'$feesamount', '$subtotal', '$code1', '$amount1', '$code2', '$amount2',

  mysql_query($query) or die (mysql_error());

I'm new with php so any help would be appreciated.

Chris Burger

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to