Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- $con = new mysqli('localhost', 'root', '', 'mydb');
- if (mysqli_connect_errno()) {
- echo "no connection";
- exit();
- }
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $username = $_POST['username'];
- $email = $_POST['email'];
- $password = $_POST['password1'];
- if(!$sql = $con->prepare("INSERT INTO mytb(username,email,password) VALUES (?,?,?)")){
- print_r($con->error); die;
- }
- $sql->bind_param('sss', $username, $email, $password);
- if($sql->execute()){
- echo 'ok';
- }
- else{
- echo 'not ok';
- }
- header("refresh:2; url=main.php");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement