我有一個php代碼插入會話值到數據庫,但我得到這個錯誤時試圖插入Error: INSERT INTO tbale name (amount,bankname) VALUES (20000.00,gtbank) Unknown column 'gtbank' in 'field list'
。會話有值GTBANK 下面是我的代碼插入會話值數據庫會話錯誤值無法插入數據庫
<?php
session_start(); {
//Include database connection details
include('../../dbconnect.php');
if($_SESSION["bn"]) {
}
$amount = strip_tags($_POST['cat']);
$field1amount = $_POST['cat'];
$field2amount = $field1amount + ($field1amount*0.5);
$sql = "INSERT INTO provide_help (amount,bankname) VALUES ($field1amount,".$_SESSION['bn'].")";
if (mysqli_query($conn, $sql))
$sql = "INSERT INTO gh (ph_id, amount) VALUES (LAST_INSERT_ID(), $field2amount)";
if (mysqli_query($conn, $sql))
{
$_SESSION['ph'] ="<center><div class='alert alert-success' role='alert'>Request Accepted.</div></center>";
header("location: PH.php");
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
}
?>
人誰可以幫助嗎?.thanks在數據的基礎上,應該覆蓋報價
雙引號爲您解決問題。在一些變量中更好地存儲會話值。 – WeAreRight