Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2003
    Posts
    1

    Question Unanswered: Populating Mysql Database multiple insert problem

    Hi everybody,

    I am trying to populate mysql database from an existing Access Database.
    I have created a file like this :

    //export.txt

    use "tests";

    Insert into Students (BS_Id,Firstname,Lastname,Username,Password,Nation ality,Email) Values (5,'???','???','???',PASSWORD('???'),'?????','');

    Insert into Students (BS_Id,Firstname,Lastname,Username,Password,Nation ality,Email) Values (6,'???','???','???',PASSWORD('???'),'?????','');

    now i have been tryng to run the file from php but without success !

    I have used

    $FILE = fopen($filennname,"r");
    while ($query = fgets($FILE,4096))
    {
    echo "$query <p><p><p>";
    #$result = func_query($query);
    }
    fclose($FILE); // close file

    thought the query is correct only the first line is inserted

    Can anyone help ?

  2. #2
    Join Date
    Jul 2003
    Posts
    2

    I guess....

    Hello,

    Try using the following instead of the while loop you are currently using:

    PHP Code:
    $query="";

    while (!
    feof ($FILE))
     {   
     
    $query.= fgets($FILE,4096);
     } 
    At the end the variable $query has all the commands in file and u can echo them, or whatever....

    I guess may be the problem is with while loop's condition. I am not quite sure, but there's nothing to loose in trying And in case, I am right, do let me know

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •