100 form piece query

Discussion in 'PHP' started by PCaine, May 6, 2008.

  1. #1
    I was wondering if it's possible to have a stable query for inserting or retrieving 100 pieces of information from the database without crashing or timeout.

    Thanks.
     
    PCaine, May 6, 2008 IP
  2. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, you can. It's just a pain to write.
     
    Altari, May 6, 2008 IP
  3. PCaine

    PCaine Peon

    Messages:
    63
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    is it possible it to time out easily? I need to write this thing extremely stable. just with mysql_query("INSERT INTO")

    and it will do it?

    and to retriveve the info with a loop?
     
    PCaine, May 6, 2008 IP
  4. mktplace

    mktplace Active Member

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #4
    If you are using mySQL, add "limit 100" to the end of a query to only get the first 100 back.

    Try not to put a query inside a loop, you will beat your database to death - if you have to do this for a bunch of inserts, then you need to decide if it is an all or nothing. If it is an all or nothing, make sure to wrap the whole loop into a transaction, so that if it fails, all the inserts get rolled back and you don't end up with junk in the DB.
     
    mktplace, May 6, 2008 IP