Jump to content
Sign in to follow this  
Kniggles

Will not ADD

Recommended Posts

Hi i have been trying to work out why this code will not add the data to the base,

any pointer please?

thanks in-advance. :)

<?php

// Database connection establishment
    $con=mysqli_connect("localhost","Deric","Password,"players");
    
// Check connection
    if (mysqli_connect_errno($con)) {
        echo "MySQL database connection failed: " . mysqli_connect_error();
    }

//CHECKING SUBMIT BUTTON PRESS or NOT.
echo "successfull here ";
    if(isset($_POST["submitBtn"]) && $_POST["submitBtn"]!=""){ 
        $name=$_POST["name"];
        $email=$_POST["email"];
        $message=$_POST["message"];

echo "$name";
echo "$email";
echo "$message";
echo "working ** ";
//INSERT QUERY
    if(mysqli_query("INSERT INTO contact (name, email, message)
        VALUES ($name, $email, $message)")){
        echo "Record inserted successfully";
    }}


?>

 

Share this post


Link to post
Share on other sites

You might be missing a quote mark in your $con line.

What output are you getting? Any errors?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...