Answers for "insert multi data in arry to database with php"

PHP
1

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));
Posted by: Guest on March-11-2020

Code answers related to "insert multi data in arry to database with php"

Browse Popular Code Answers by Language