dpf56454 2017-12-18 16:55
浏览 58
已采纳

如何使用php脚本登录系统到数据库?

i am trying to build a simple login system with php , but it dosent send the the user data to the data base i an using XAMPP as a server, plz check my code...

here is my dbh.inc.php - the file that connect to the server.

<?php 

$dbservername="localhost";
$dbusername="root";
$dbpassword="";
$dbname="loginsystem";



$conn= mysqli_connect($dbservername,$dbusername,$dbpassword,$dbname);

and here is my php script signup.inc.php that handle that send the data to the data base and tell it to put it in the pre table that i have set from the beginning

<?php


if  (isset($_POST['submit'])) {

include_once 'dbh.inc.php'; 

$first = mysqli_real_escape_string($conn, $_POST['first']); 
$last = mysqli_real_escape_string($conn, $_POST['last']); 
$email = mysqli_real_escape_string($conn, $_POST['email']); 
$uid = mysqli_real_escape_string($conn, $_POST['uid']); 
$pwd = mysqli_real_escape_string($conn, $_POST['pwd']); 




// inset the form data to the data base . 


    $sql= "INSERT_INTO users (user_first, user_last, user_email, user_uid, user_pwd) VALUES ('$first', '$last' , '$email', '$uid' , '$pwd');";
   mysqli_query($conn, $sql);

   exit(); 
// error handlers 
// check for empty fields. 


}


else {
header("Location: ../signup.php"); 
exit();

}
  • 写回答

1条回答 默认 最新

  • donglian6625 2017-12-18 17:10
    关注

    try to correct the query statement

    $sql= "INSERT INTO users (user_first, user_last, user_email, user_uid, user_pwd) VALUES ('$first', '$last' , '$email', '$uid' , '$pwd')";
    

    INSERT INTO instead of INSERT_INTO and remove the ; after the )

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名