Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2013

    Question Unanswered: Insert into postgresql db with loop for

    Hi All,
    when I try to insert a lot of rows in a postgresql db with for loop php:

    PHP Code:
    function foo() {

    $input = array('bar');

    $db=connection_pgsql() or die('Connessione al DBMS non riuscita');
        for (

    pg_prepare"run","INSERT INTO tab1(name) VALUES  ($1)");


    In my db are stored only about 100 rows and not 1000 rows. echo $i print not all number from 0 to 1000 but it stops at random number < 1000

  2. #2
    Join Date
    Jun 2017
    Use sleep function, sometimes it overload the server as loop runs very fast.

Tags for this Thread

Posting Permissions

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