PHP registration function
忧伤的大白兔
忧伤的大白兔 2021-02-20 21:02:35
0
4
987

session_start();

$conn = mysqli_connect("localhost","root","123456","per") or die("Database Server Connection error".mysqli_connect_error()); //Connect to the database

mysqli_set_charset($conn,"utf8"); //Set the encoding format

$name=$ _POST['username']; //trim function filters spaces

$password = $_POST['pwd'];

if($name=='' ){

echo" ;";

exit;

}

if($password==''){

echo"";

exit;

}

$sql="insert into per_user form(username,password) values('$name','$password')";

$result=mysqli_query($ conn, $ sql);

IF (! $ Result) // Judging whether the data is successfully inserted into the database

{

## Echo mysqli_error ($ conn);

}

through out’s ’ out through out’s ’’s ’ through out through out through ’’s' through through through out through ’ ‐ ‐ through's''''''‐''''‐through's to 1 to 1 to 1 to 1’ to the 10th anniversary of ## echo "Log in now";

忧伤的大白兔
忧伤的大白兔

reply all (3)
云上屹立君

insert into per_user (username,password) values ($name,$password);

Where did you see this from

    忧伤的大白兔

    The two rabbits are the username and password I typed randomly during the test

      忧伤的大白兔

      Your SQL syntax is incorrect. Check the manual corresponding to your MySQL server version for the correct syntax to use

      ## near 'form(username, password) values('rabbit', 'rabbit')' on line 1

      # After checking, this is an error message

      • reply $sql="insert into per_user (username,password) values ('$name','$password')"; Try it this way
        路边的小蚂蚁i author 2021-02-21 16:30:12
      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!