----- Original Message -----
From: "Jari Mäkelä" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, May 25, 2001 0:10
Subject: adding many entries to database
> Hi,
>
> could any one tell what am doing wrong with this. I have a file of which
> parts needs to be transferred to database but after successfully moving 66
> entries into the database it dies at the mysql_query. There would be about
> 10 times more entries remaining. The file is delimited with ; but it is
not
> to be transferred to database just one parts of it.
>
>
> <?php
> $connect = mysql_connect("host","user","password") or die(" connection
> error !!!!");
>
> mysql_select_db("arkipelag",$connect) or die("No database error !!!");
>
> $lines = file('info.txt');
> foreach ($lines as $line)
> { $p = explode(';',$line);
>
> $string[4] = substr ("$p[4]", 1, -1);
> $string[5] = substr ("$p[5]", 1, -1);
> $string[6] = substr ("$p[6]", 1, -1);
> $query = "INSERT INTO names VALUES
> ('0','$string[4]','$string[5]','$string[5]')";
Well, you have 2 $string[5] here. Could that be why? Otherwise, why the
$string[6] line?
> $result = mysql_query ($query,$connect) or die ("input error!!!");
> }
> ?>
>
>
> Jari Mäkelä
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php