Kev0121 Posted March 7, 2009 Share Posted March 7, 2009 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"; } ?> Quote Link to comment Share on other sites More sharing options...
marcus Posted March 7, 2009 Share Posted March 7, 2009 $insertData = "INSERT INTO `test` (`title`,`author`,`content`) VALUES('".$title."','".$author."','".$content."')"; Quote Link to comment Share on other sites More sharing options...
Kev0121 Posted March 7, 2009 Author Share Posted March 7, 2009 Thanks alot works Kevin Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.