Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to bulk insert array into sql php

$sql = array(); 
foreach( $data as $row ) {
    $sql[] = '("'.mysql_real_escape_string($row['text']).'", '.$row['category_id'].')';
}
mysql_query('INSERT INTO table (text, category) VALUES '.implode(',', $sql));
 
PREVIOUS NEXT
Tagged: #bulk #insert #array #sql #php
ADD COMMENT
Topic
Name
4+5 =