Created
July 19, 2019 06:33
-
-
Save mahdiyazdani/e324e4a518ad1d896476002f9d67aa45 to your computer and use it in GitHub Desktop.
Insert array to mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mysqli = new mysqli( DB_HOST, DB_USER, DB_PASSWORD, DB_NAME ) or die( 'Could not connect' ); | |
// Check connection | |
if ( mysqli_connect_errno() ) { | |
printf( "Connect failed: %s\n", mysqli_connect_error() ); | |
exit(); | |
} | |
$values = array( | |
'XXX', | |
'XXX2', | |
'XXX3' | |
); | |
foreach( $values as $value ) { | |
$mysqli->query( "INSERT INTO `TABLE` (`COLUMN`) VALUES ('$value')" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment