I have switched over to PDO using the link provided and wrote the following code only to get an error referring to the same variable containing the insert.
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
This error is referring to the line after the $stmt INSERT.
<?php
$servername = "XXXXXXXXXX";
$username = "ymodb";
$password = "XXXXXXXXX";
$dbname = "ymodb";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// prepare sql and bind parameters
$stmt = $conn->prepare("INSERT INTO users (fullname, email, password, fname, email1, password1, relationship) VALUES ('$_POST['fullname']','$_POST['email']','$_POST['password']','$_POST['fname']','$_POST['email1']','$_POST['password1']','$_POST['relationship']')");
$stmt->execute();
echo "New records created successfully";
}
catch(PDOException $e)
{
echo "Error: " . $e->getMessage();
}
$conn = null;
?>