1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to insert 31103 rows of an array into mysql data base ?

Discussion in 'PHP' started by ramysarwat, Oct 27, 2010.

  1. #1
    hi

    i am trying to insert 31103 row of array into mysql data base

    but every time i check the inserted data its not complete in the last try i get 8955 rows of 31103

    so what is the right way to do this ?
     
    ramysarwat, Oct 27, 2010 IP
  2. Layoutzzz

    Layoutzzz Greenhorn

    Messages:
    78
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #2
    You should insert data in parts.
    You can use for it Ajax
     
    Layoutzzz, Oct 27, 2010 IP
  3. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #3
    It might just be a script timeout.
    If there is no error in your query, increase max_execution_time.
     
    wing, Oct 27, 2010 IP
  4. ramysarwat

    ramysarwat Peon

    Messages:
    164
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i don't use ajax but i use the for function to insert data row by row
     
    ramysarwat, Oct 28, 2010 IP
  5. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Have you tested to timeout protect your loop?
    for (....) {
    // lots of stuff
    set_time_limit(120);
    }

    :)
     
    wing, Oct 28, 2010 IP
  6. ramysarwat

    ramysarwat Peon

    Messages:
    164
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6

    thanks for the code but still the same problem

    i think php is working faster that the mysql server because i lose separate rows from the middle of the array

    is there any way to make php wait the mysql server
     
    ramysarwat, Oct 28, 2010 IP
  7. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #7
    Can I suggest you turn error reporting ON
    error_reporting(E_ALL);
    PHP:
    so you know the exact cause of the in-completed task, it may not be time related.

    If your convinced its time related, then post your foreach statement code, for better advice. Also bare in mind set_time_limit(); wont work if php safe_mode is on, so check that out from your php configuration.
     
    MyVodaFone, Oct 28, 2010 IP