No announcement yet.

inserting more than 10k rows with 1 mysql_query call

  • Filter
  • Time
  • Show
Clear All
new posts

  • inserting more than 10k rows with 1 mysql_query call


    my problem is,.. that i have a $var set like this:

    PHP Code:
    $var "INSERT INTO table (col1, col2) VALUES ('blah', 'blah'), ('blah2', 'blah2'), ('blah3', 'blah3'),... "
    the problem is... i want to insert more than 10.000 rows with one mysql_query call.

    when i do $result = mysql_query ($var) or die (mysql_error ()) i get error "MySQL server has gone away". why?

    when using phpmyadmin and if inserting a SQL file in it there is no such problem. doesn't matter how many rows i want to insert into a table.

    but i MUST use the php coding (and not phpmyadmin) to insert that 10k rows. can you please tell me how to do that?

    thank you very much and best best regards!

  • #2
    I'm not sure if this helps at all (i have no idea what it means):
    MySQL Docs: A.2.2 MySQL server has gone away Error


    • #3
      just wandering, why do you need to do 10,000 anyways? what is it for, coz then there might be a way


      • #4
        well.. i am making a program in php for a company that adds news in their M$ Access database. now, they decided to go online now. now, they export all acc database tables to txt files with all info and stuff, and i must refresh it every day. so i parsed row by row from txt file to mysql_query call and that's it

        i hope you understand what i said. if not, i'm sorry, more i can't tell.. it's like top secret work. bussiness secret if you know what i mean.

        well.. i made it now, with looping and calling mysql query one by one and it works well.

        thanks for helping


        • #5
          exactly what i was going to suggest if you had said what you just said


          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.