Created
March 30, 2017 14:01
-
-
Save marcosnakamine/17547b260d53eb9475af14eeff15fcfa to your computer and use it in GitHub Desktop.
PHP - MySQLi mysqli_connect, query, fetch_array, mysqli_escape_string
This file contains hidden or 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 | |
$db = mysqli_connect( 'host','user_name','password', 'data_base_name' ); | |
$query = $db->query(' | |
SELECT * FROM table_name | |
WHERE id = mysqli_escape_string( $db, '1' ) | |
'); | |
if( $query->num_rows > 0 ){ | |
while ( $row = $query->fetch_array() ) { | |
var_dump( $row ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment