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

    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 :


    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

    I guess....


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

    PHP Code:

    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