J'ai un casse-tête au niveau de ma requête [C]mysqli-prepared[/C] dans mon Code PHP ci-dessous.
Pourtant, je reçois bien afficher le Message à succès Money Deposited:
Le souci, c'est que je n'arrive pas du tout à réussir l'insertion dans la Base de Données:
Code : Tout sélectionner
<?php
session_start();
include('conf/config.php');
include('conf/checklogin.php');
check_login();
$admin_id = $_SESSION['admin_id'];
//register new account
if (isset($_POST['deposit'])) {
$tr_code = $_POST['tr_code'];
$account_id = $_GET['account_id'];
$acc_name = $_POST['acc_name'];
$account_number = $_GET['account_number'];
$acc_type = $_POST['acc_type'];
//$acc_amount = $_POST['acc_amount'];
$tr_type = $_POST['tr_type'];
$tr_status = $_POST['tr_status'];
$client_id = $_GET['client_id'];
$client_name = $_POST['client_name'];
$client_national_id = $_POST['client_national_id'];
$transaction_amt = $_POST['transaction_amt'];
$client_phone = $_POST['client_phone'];
//$acc_new_amt = $_POST['acc_new_amt'];
//Notication
$notification_details = "$client_name Has Deposited Ksh $transaction_amt To Bank Account $account_number";
//Insert Captured information to a database table
$query = "INSERT INTO iB_Transactions (tr_code, account_id, acc_name, account_number, acc_type, tr_type, tr_status, client_id, client_name, client_national_id, transaction_amt, client_phone) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
$notification = "INSERT INTO iB_notifications (notification_details) VALUES (?)";
$stmt = $mysqli->prepare($query);
$notification_stmt = $mysqli->prepare($notification);
//bind paramaters
$rc = $notification_stmt->bind_param('s', $notification_details);
$rc = $stmt->bind_param('ssssssssssss', $tr_code, $account_id, $acc_name, $account_number, $acc_type, $tr_type, $tr_status, $client_id, $client_name, $client_national_id, $transaction_amt, $client_phone);
$stmt->execute();
$notification_stmt->execute();
//declare a varible which will be passed to alert function
if ($stmt && $notification_stmt) {
$success = "Money Deposited";
} else {
$err = "Please Try Again Or Try Later";
}
}
if(isset($_POST['deposit']))
{
$account_id = $_GET['account_id'];
$acc_amount = $_POST['acc_amount'];
//Insert Captured information to a database table
$query="UPDATE iB_bankAccounts SET acc_amount=? WHERE account_id=?";
$stmt = $mysqli->prepare($query);
//bind paramaters
$rc=$stmt->bind_param('si', $acc_amount, $account_id);
$stmt->execute();
//declare a varible which will be passed to alert function
if($stmt )
{
$success = "Money Deposited";
}
else
{
$err = "Please Try Again Or Try Later";
}
}
?>Aidez-moi donc à me corriger et réussir mes insertion s'il vous plaît.