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"; } ?> Link to comment https://forums.phpfreaks.com/topic/148320-insert-error-msg/ 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."')"; Link to comment https://forums.phpfreaks.com/topic/148320-insert-error-msg/#findComment-778708 Share on other sites More sharing options...
Kev0121 Posted March 7, 2009 Author Share Posted March 7, 2009 Thanks alot works Kevin Link to comment https://forums.phpfreaks.com/topic/148320-insert-error-msg/#findComment-778710 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.