angryjohnny Posted May 27, 2008 Share Posted May 27, 2008 Hi, I have been designing and coding (frontend html, javascipt CSS ) for over 6 years now and I'm just now taking the next step with building dynamic sites. I have created a very simple database which has 6 Colums, I have created a page that displays the table and now I'm creating a page that the admin can add to the table. My problem is this, I am able to write to two of the colums but when I go to try and write to a 3rd the database doesn't get updated. Here is my code that works. if (isset($_POST['name']['bio'])) { $name = $_POST['name']; $bio = $_POST['bio']; $sql = "INSERT INTO employee SET name='$name', bio='$bio' "; This code above works but when I go to write add another colum (title) to be writen to it breaks. if (isset($_POST['name']['title']['bio'])) { $name = $_POST['name']; $title = $_POST['title']; $bio = $_POST['bio']; $sql = "INSERT INTO employee SET name='$name', title='$title', bio='$bio' "; I know I'm not writing this properly, I have tried a few other ways but can't seem to get it right. Any help would be most appreciated. Thanks John Link to comment https://forums.phpfreaks.com/topic/107491-adding-multiple-fields-to-a-table/ Share on other sites More sharing options...
BlueSkyIS Posted May 27, 2008 Share Posted May 27, 2008 mysql error? mysql_query($sql) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/107491-adding-multiple-fields-to-a-table/#findComment-550950 Share on other sites More sharing options...
angryjohnny Posted May 27, 2008 Author Share Posted May 27, 2008 sorry I should have said... I don't get an error but nothing gets writen to the table when I submit the form. it works when I try to write to just the two colums. Link to comment https://forums.phpfreaks.com/topic/107491-adding-multiple-fields-to-a-table/#findComment-550952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.