I have tried a lot of syntax trials with single quotes and $session variables, now i decided to put the session variables in regular variables for less syntax complications.
$conn = mysql_connect($servername, $username, $password);
// Check connection
if (!$conn) {
die("Connection failed: " . mysql_error());
}
if (!mysql_select_db($dbname)) {
die('Could not select database: ' . mysql_error());
}
$this_email = $_SESSION['email'];
$this_password = $_SESSION['pw'];
$this_number = $_SESSION['phone'];
$sql = mysql_query("INSERT INTO user_accounts(Email, Password, Phone#) VALUES ('$this_email','$this_password','$this_number')");
if (!$sql) {
echo mysql_error();
}
mysql_close($conn);
This is the error i get:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1