mysqli::stmt_init
(MySQLI_STMTT_INIT) သည်ကြေငြာချက်တစ်ခုကို အစပြု. MySQLI_SSTMT_PREPARE ဖြင့်အသုံးပြုသောအရာဝတ်ထုတစ်ခုကိုပြန်ပို့ပါ
stmt_init()
/ mysqli_stmt_init()
function သည်ထုတ်ပြန်ချက်ကိုအကန့်အသတ်နှင့် mysqli_stmt_prepare()
အသုံးပြုမှုအတွက်သင့်တော်သောအရာဝတ်ထုကိုပြန်လည်ရောက်ရှိစေသည်။
ကြေငြာချက်တစ်ခုကို အစပြု. stmt_prepare()
အတွက်အရာဝတ်ထုတစ်ခုကိုပြန်ပို့ပါ။
<? PHP $ MySQLI = MYSQLI ( "localhost" , "My_USER" , " MY_UPSSWORD" , "MY_DB" ) ; if ( $ MySQLI -> Connect_errno ) { ECHO "MYSQL ကိုချိတ်ဆက်ရန်မအောင်မြင်ပါ။ " $ MySQLI -> Connect_Error ; ထွက်ပေါက် ( ) ; } $ City = "Sandnes" ; // preprocessing ကြေညာချက်ကိုဖန်တီးပါ $ stmt = $ MySQLI -> stmt_init ( ) ; အကယ်. ( $ stmt -> ကြိုတင်ပြင်ဆင်မှု ( ") မြို့မှအမည် =) အမည် =? " ) ) // bind portameters တွေကို $ stmt -> bind_param ( "s" , $ city ) ; // execute query ကို $ stmt -> execute ( ) ; // ရလဒ် variable ကိုခညျြနှောငျ $ stmt -> bind_result ( $ ခရိုင် ) , // တန်ဖိုးကိုရယူပါ $ stmt -> fetch ( ) ; Printf ( "% s သည်ခရိုင်% s" , ဒေါ်လာမြို့ , ဒေါ်လာခရိုင် ) , // အနီးကပ်ကြေညာချက် $ stmt -> အနီးကပ် ( ) , } $ MySQLI -> အနီးကပ် ( ) , >
ကြေငြာချက်တစ်ခုကို အစပြု. MySQLI_STMTT_PREPARE အတွက်အရာဝတ်ထုတစ်ခုကိုပြန်ပို့ပါ။
<? PHP $ con = mySQLI_Connect ( "local_user" , "My_Password" , "My_DB" , "my_DB " , if ( MySQLI_Connect_ERRNO ( ) ) { ECHO "MYSQL ကိုချိတ်ဆက်ရန်မအောင်မြင်ပါ။ " MySQLI_Connect_Error ( ) ; ထွက်ပေါက် ; } $ City = "Sandnes" ; // preprocessing ကြေညာချက်ကိုဖန်တီးပါ $ stmt = MySQLI_STMT_INIT ( $ con ) ; IF ( MySQLI_STMT_PREPATE ( $ stmt " အမည် = ) အမည် =?" ) ) မြို့မှခရိုင်ကိုရွေးချယ်ပါ // bind portameters တွေကို mysqli_stmt_bind_param ( $ stmt , "S" , $ မြို့ ) , // execute query ကို MySQLI_STMT_Execute ( $ stmt ) ; // ရလဒ် variable ကိုခညျြနှောငျ mysqli_stmt_bind_result ( $ stmt , $ ခရိုင် ) ; // တန်ဖိုးကိုရယူပါ mysqli_stmt_fetch ( $ stmt ) ; Printf ( "% s သည်ခရိုင်% s" , ဒေါ်လာမြို့ , ဒေါ်လာခရိုင် ) , // အနီးကပ်ကြေညာချက် MySQLI_STMT_CLOSE ( $ stmt ) ; } MySQLI_CLOSE ( $ con ) ; >