Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php insert array into mysql

if(is_array($records)){
    foreach ($records as $row) {
        $fieldVal1 = mysqli_real_escape_string($conn, $row[0]);
        $fieldVal2 = mysqli_real_escape_string($conn, $row[1]);
        $fieldVal3 = mysqli_real_escape_string($conn, $row[2]);
 
        $query ="INSERT INTO programming_lang (field1, field2, field3) VALUES ( '". $fieldVal1."','".$fieldVal2."','".$fieldVal3."' )";
        mysqli_query($conn, $query);
    }
}
Source by www.phpflow.com #
 
PREVIOUS NEXT
Tagged: #php #insert #array #mysql
ADD COMMENT
Topic
Name
6+3 =