mysqli::real_query
(mysqli_real_query) Execute SQL query
real_query()
/ mysqli_real_query()
functions perform a single SQL query. The results can be retrieved or stored using store_result()
or use_result()
functions.
Perform a single SQL query. Use store_result()
to store the results:
<?php $mysqli = new mysqli ( "localhost" , "my_user" , "my_password" , "my_db" ) ; // Check the connection if ( $mysqli -> connect_errno ) { echo "Failed to connect to MySQL: " . $mysqli -> connect_error ; exit ( ) ; } $mysqli -> real_query ( "SELECT * FROM Persons" ) ; if ( $mysqli -> field_count ) { $result = $mysqli -> store_result ( ) ; $row = $result -> fetch_row ( ) ; // Release the result set $result -> free_result ( ) ; } $mysqli -> close ( ) ; ?>