Funkce PHP mysqli real_query().
Příklad - Objektově orientovaný styl
Proveďte jeden SQL dotaz. Uložte výsledek pomocí store_result():
<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");
// Check 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();
// Free result set
$result -> free_result();
}
$mysqli -> close();
?>
Definice a použití
Funkce real_query() / mysqli_real_query() provede jeden SQL dotaz. Výsledek lze získat nebo uložit pomocí funkcí store_result() nebo use_result().
Syntax
Objektově orientovaný styl:
$mysqli -> real_query(query)
Styl postupu:
mysqli_real_query(connection, query)
Hodnoty parametrů
Parameter | Description |
---|---|
connection | Required. Specifies the MySQL connection to use |
query | Required. The query to be executed |
Technické údaje
Návratová hodnota: | PRAVDA o úspěchu. NEPRAVDA při selhání |
---|---|
Verze PHP: | 5+ |
❮ Reference PHP MySQLi