array_push php
<?php
$cesta = array("laranja", "morango");
array_push($cesta, "melancia", "batata");
print_r($cesta);
?>
array_push php
<?php
$cesta = array("laranja", "morango");
array_push($cesta, "melancia", "batata");
print_r($cesta);
?>
php add item to array
<?php
$z = ['me','you', 'he'];
array_push($z, 'she', 'it');
print_r($z);
?>
php insert in array
$original = array( 'a', 'b', 'c', 'd', 'e' );
$inserted = array( 'x' ); // not necessarily an array, see manual quote
array_splice( $original, 3, 0, $inserted ); // splice in at position 3
// $original is now a b c x d e
php insert array into mysql
if(is_array($records)){
$DataArr = array();
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]);
$DataArr[] = "('$fieldVal1', '$fieldVal2', '$fieldVal3')";
}
$sql = "INSERT INTO programming_lang (field1, field2, field3) values ";
$sql .= implode(',', $DataArr);
mysqli_query($conn, $query);
}
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);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us