note 108807 modified in internals2.opcodes.mod by danbrown

From: Date: Fri, 25 May 2012 16:30:47 +0000
Subject: note 108807 modified in internals2.opcodes.mod by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188240@lists.php.net to get a copy of this message
Might be helpful:

I had to create and "INSERT INTO" on every 50th row:

<?php
$lineBreak = 50;
$tableName = 'user';
$tableFields = 'id, name, password';
?>

in the loop:

<?php
if ($counter === 0 || $counter % $lineBreak === 0) {
 echo "INSERT INTO $tableName ($tableFields) VALUES (";
} else {
 echo ' (';
}

// add values comma-delimited

if ($counter === 0 || $counter % $lineBreak === 0) {
 $insertStmt .= ');';
} else {
 $insertStmt .= '),';
}
?>

(in my case I had to check if $no % $o === 0) --was-- Might be helpful: I had to create and "INSERT INTO" on every 50th row: $lineBreak = 50; $tableName = 'user'; $tableFields = 'id, name, password'; in the loop: if ($counter === 0 || $counter % $lineBreak === 0) { echo "INSERT INTO $tableName ($tableFields) VALUES ("; } else { echo ' ('; } // add values comma-delimited if ($counter === 0 || $counter % $lineBreak === 0) { $insertStmt .= ');'; } else { $insertStmt .= '),'; } (in my case I had to check if $no % $o === 0) http://php.net/manual/en/internals2.opcodes.mod.php

« previous php.notes (#188240) next »