Results 1 to 1 of 1
\r\n \r\n\r\n \r\n \r\n
\r\n
\r\n
\r\n Hi All,
\r\nwhen I try to insert a lot of rows in a postgresql db with for loop php:
\r\n
\r\n
\r\n
PHP Code:
\r\n
\nfunction foo() {\r
\r
    
$input = array(\'bar\');\r
\r
    
$db=connection_pgsql() or die(\'Connessione al DBMS non riuscita\');\r
    for (
$i=0;$i<1000;$i++) \r
    {\r
\r
      echo 
$i;\r
      
pg_prepare"run","INSERT INTO tab1(name) VALUES  ($1)");\r
      
pg_execute("run",$input);\r
\r
    }\r
   \r
    
pg_close($db);\r
} \r
\n
\n
\r\n
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
\r\n
\r\n
\r\n\r\n \r\n\r\n\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n Reply With Quote Reply With Quote \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n\r\n'; // next/previous post info pn[6646110] = "6646110,6646110"; pn[0] = ",6646110"; // cached usernames pu[0] = guestphrase; pu[337199] = "chileme88"; // -->

Threaded View

  1. #1
    Join Date
    Dec 2013
    Posts
    3

    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 (
    $i=0;$i<1000;$i++) 
        {

          echo 
    $i;
          
    pg_prepare"run","INSERT INTO tab1(name) VALUES  ($1)");
          
    pg_execute("run",$input);

        }
       
        
    pg_close($db);

    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

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
  •