Jump to content

Insert Error Msg


Kev0121

Recommended Posts

Getting error message when inserting information into my database

heres my errror

 

Unknown column 'Test' in 'field list'

 

Heres my code

 

<?php 
include 'connection.php'; 
?> 

<html> 
<head> 
    <title>Insert Into Blog</title> 
</head> 
<body> 
    <form action = "<?php $_SERVER['PHP_SELF']; ?>" method="POST" name="insert"> 
        <table> 
            <tr> 
            <td>Post Title : <input type="text" name="pTitle" /> </td> 
            <tr> 
            <tr> 
            <td>Post Author : <input type="text" name="pAuth" /> </td> 
            <tr> 
            <td>Post Content : <br/> <input type="text" name="pContent"/> </td> 
            <tr> 
            <td><input type="submit" name="Submit" value="Done" /> </td> 
        </table> 
    </form> 
</body> 
</html> 

<?php 
$title = $_POST['pTitle']; 
$author = $_POST['pAuth']; 
$content = $_POST['pContent']; 

if(isset($_POST['Submit'])) { 
    $insertData = "INSERT INTO `test` (title,author,content) VALUES ($title, $author, $content)"; 
    $query = mysql_query($insertData) or die(mysql_error()); 
}else { 
    echo "Error"; 
} 
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.