使用准备好的SQL函数在MySQL中插入数据的问题

时间:2019-07-16 10:15:39

标签: php html

我正在使用Prepared语句插入数据库中,它没有显示任何错误,但是数据未插入数据库中。

那为什么不起作用?

<body>

<form action="Includes/signup.php" method="post">

<input type="text" name="FName" placeholder="Full Name"><br> <br>

<input type="text" name="email" placeholder="E-mail"> <br><br>

<input type="number" name="Samount" placeholder="amount"><br><br>

<input type="password" name="pwd" placeholder="pass"> <br><br>

<button type="submit" name="submit">Sign UP</button>

    </form>



<?php include_once('../dbconnection.php'); 

 $FullName =mysqli_real_escape_string($connection,$_POST['FName']);

 $Email =mysqli_real_escape_string($connection,$_POST['email']);

$Amount = mysqli_real_escape_string($connection,$_POST['Samount']);

$Pass =mysqli_real_escape_string($connection,$_POST['pwd']);


$sql = "INSERT INTO users (email,password,full_name,Spending_Amt) Values (?,?,?,?);";



$stmt = mysqli_stmt_init($connection);


 if (!mysqli_stmt_prepare($stmt,$sql)) {
     echo "SQL ERROR";
 } else {



mysqli_stmt_bind_param($stmt,"sssi",$Email,$pass,$FullName,$Amount);

    // Run Parameters inside data base
    mysqli_stmt_execute($stmt);



 } ?>

因此代码运行平稳,但是没有插入数据

0 个答案:

没有答案