Try this.  I made some minor syntax changes and added some error reporting.
While it may not fix things, it might help you figure out what's wrong.

<?
$mails=file("mails.txt");
$number_of_mails = count($mails);

for ($i=0; $i<$number_of_mails; $i++)
{
    $link = @ mysql_connect("localhost")
        or die( mysql_error() );
    $db = mysql_select_db("me2resh00", $link);
    $query = "insert into recipients (recipient_name, recipient_email) values
        (\"friend\", \"".$mails[$i]."\")";
    $result = mysql_query($query);
    if ($result)
    echo mysql_affected_rows()." affected.";
}
?>

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Ahmed Abdelaliem" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, 07 June, 2003 08:15
Subject: [PHP-DB] problem with insert query


hi
i am wrote a script to read e-malis from a file and insert it into the
tables of database
i get error when i write it
here is the code
can anyone tell me what is wrong?

<?
$mails=file("mails.txt");
$number_of_mails = count($mails);

for ($i=0; $i<$number_of_mails; $i++){

     @ $db = mysql_connect("localhost");
mysql_select_db("me2resh00");
$query = "insert into recipients (recipient_name, recipient_email) values
('"friend"', '".$mails[$i]."')";
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows()." affected.";

   }
     ?>


here is the error that i get

Parse error: parse error in enter.php on line 9


and line 9 is

$query = "insert into recipients (recipient_name, recipient_email) values
('"friend"', '".$mails[$i]."')";

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to