To understand SQL Injection i wanted to build a basic example with PHP and MySQL:
If I try to execute a command with a single quote i get the following error:
Is there a other possibilty to inject code in this example?
Here my code:
<?php
include_once 'C:\xampp\htdocs\phplessons\includes\dbh.inc.php';
//$first = mysqli_real_escape_string($conn, $_POST['first']);
$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];
$uid = $_POST['uid'];
$pwd = $_POST['pwd'];
$sql = "INSERT INTO users (user_first, user_last, user_email, user_uid, user_pwd) VALUES ('$first', '$last', '$email', '$uid', '$pwd');";
mysqli_query($conn, $sql);
header("Location: ../index.php?signup=success");