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 :: 15000 tl to usd 
Php :: array reduce associative array php 
Php :: get value from json laravel 
Php :: codeigniter table list 
Php :: get image width and height in laravel 
Php :: delete uploaded file php 
Php :: laravel auth user_id 
Php :: Flutter migrate to Android Studio 
Php :: laravel get request check 
Php :: woo set_stock_quantity 
Php :: register_post_type wordpress 
Php :: twig is in string 
Php :: php delete json object from a collection object 
Php :: how to zip a folder using php 
Php :: php zeilenumbruch 
Php :: laravel update by id 
Php :: laravel try catch example 
Php :: php array order by value 
Php :: snap store phpstrom 
Php :: Fatal error: Allowed memory size of 1610612736 bytes exhausted 
Php :: ternary operator in php 
Php :: php server sent events 
Php :: laravel redirect to intended page after register 
Php :: twig variable exists 
Php :: acf get field 
Php :: what is scalar data type in php 
Php :: send attachment in mail php 
Php :: laravel check if object is empty 
Php :: php hello world 
Php :: php json_encode utf8 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =