我正在尝试根据用户输入创建准备好的语句,并将其保存到数据库中,但是在执行时似乎失败:
这是我的代码。有人知道我的代码有什么问题吗
<?php
session_start();
require_once 'conn.php';
if($_GET['orderform']){
if($_GET['username'] and $_GET['time'] and $_GET['quantity'] and $_GET['image'] and $_GET['uprice']){
$x = $_GET['uprice'];
$y = $_GET['quantity'];
$total = $x*$y;
$userid = $_SESSION[id];
$username = $_GET['username'];
$quantity = $_GET['quantity'];
$time = $_GET['time'];
$image = $_GET['image'];
$uprice = $_GET['uprice'];
$stm=$query=$conn = "INSERT INTO `orders` (userid, username, quantity, timee, image, uprice, tprice) VALUES(:userid, :username, :quantity, :timee, :image, :uprice, :tprice)";
$stmt = $conn->prepare($stm);
$stmt->bindParam(':userid', $userid);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':quantity', $quantity);
$stmt->bindParam(':timee', $time);
$stmt->bindParam(':image', $image);
$stmt->bindParam(':uprice', $uprice);
$stmt->bindParam(':tprice', $total);
$stmt->execute();
if($stmt->execute()){
header('location: index.php');}
}
}
?>