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
https://forums.phpfreaks.com/topic/148320-insert-error-msg/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.