Search
 
SCRIPT & CODE EXAMPLE
 

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));
Comment

php bulk insert mysql

$values = array(); 
foreach($data as $row ) {
    $values[] = '('.$row['id'].', "'.mysql_real_escape_string($row['name']).'")';
}
mysql_query('INSERT INTO table (id, name) VALUES '.implode(',', $sql));
Comment

PREVIOUS NEXT
Code Example
Php :: setcookie in php 
Php :: create curl api request php with para 
Php :: return only one column data from table in codeigniter 
Php :: php build query from array 
Php :: php number format without rounding 
Php :: Laravel migrations custom foreign key 
Php :: php get slug 
Php :: php apply function to array elements 
Php :: php array sort by key 
Php :: seprate day and year from laravel to timestamp 
Php :: Session/Session.php error codeigniter 3 
Php :: laravel backup 
Php :: PHP strtolower — Make a string lowercase 
Php :: php string functions 
Php :: remove more than one space in string php 
Php :: php class file upload 
Php :: wordpress debug mode 
Php :: php count days excluding weekends 
Php :: php prepared statement upload file 
Php :: read pdf text php 
Php :: clear session in laravel 
Php :: php hour between 
Php :: wordpress enqueue if shortcode 
Php :: json_encode php 
Php :: Write a Multiplication program of two numbers in php using operator 
Php :: enable extensions in php.ini 
Php :: php integer 
Php :: laravel project make 
Php :: php preg replace 
Php :: how to fetch the sum of column in php mysql 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =