PHP mysqli real_query() လုပ်ဆောင်ချက်
ဥပမာ - Object Oriented စတိုင်
SQL Query တစ်ခုတည်းကို လုပ်ဆောင်ပါ။ ရလဒ်ကို 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();
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
real_query() / mysqli_real_query() လုပ်ဆောင်ချက်သည် SQL မေးခွန်းတစ်ခုတည်းကို လုပ်ဆောင်သည်။ ရလဒ်ကို store_result() သို့မဟုတ် use_result() လုပ်ဆောင်ချက်များဖြင့် ပြန်လည်ရယူခြင်း သို့မဟုတ် သိမ်းဆည်းနိုင်သည်။
အထားအသို
အရာဝတ္ထုကို ဦးတည်သည့်ပုံစံ-
$mysqli -> real_query(query)
လုပ်ထုံးလုပ်နည်းပုံစံ-
mysqli_real_query(connection, query)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
connection | Required. Specifies the MySQL connection to use |
query | Required. The query to be executed |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အောင်မြင်မှုအပေါ် သစ္စာရှိပါ။ ရှုံးနိမ့်မှုအပေါ် မှားသည်။ |
---|---|
PHP ဗားရှင်း- | ၅+ |
❮ PHP MySQLi အကိုးအကား