Help! problems inserting into db (object oriented)!

I’m trying again on this project. I’m using object oriented. Basically, I’m using an HTML form to collect some data, then process it via PHP. The portion below is supposed to insert this data into the DB. It doesn’t work, but produces no errors of any kind. I have no idea what is going on. I’m very new to PHP. Please help! Thanks!

require_once('config/connect.php');

$yourname = mysqli_real_escape_string($link, $_REQUEST['yourname']);
$ip = mysqli_real_escape_string($link, $_REQUEST['ip']);
$yourmail = mysqli_real_escape_string($link, $_REQUEST['yourmail']);
$friendmail = mysqli_real_escape_string($link, $_REQUEST['friendmail']);

$sql = "INSERT INTO node1 (username, ip, yourmail, friendmail) VALUES ('$yourname', '$ip', '$yourmail', '$friendmail')";
if(mysqli_query($link, $sql)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}

$mysqli->close();

3 posts were merged into an existing topic: Issues inserting data into MYSQL table via PHP file! help!

Sponsor our Newsletter | Privacy Policy | Terms of Service