stijn0713 Posted July 18, 2012 Share Posted July 18, 2012 foreach (array_keys($_POST['cb'],'on') as $k) { $query2 = "INSERT INTO deelname_respondent (respondent_id, groep_id, vergoeding, status_bevestigd) VALUES (%d, %d, %f, %d)"; $id_respondent_on = $k; $bedrag_respondent_on = $_POST['bedrag'][$k]; $email_respondent_on = $_POST['hf'][$k]; $naam_respondent_on = $_POST['name'][$k]; $query2 = sprintf("$query2", $id_respondent_on, $_SESSION['gekozen_groep'], $bedrag_respondent_on, 0); If i echo it out i get e.g. INSERT INTO deelname_respondent (respondent_id, groep_id, vergoeding, status_bevestigd) VALUES (1, 88, 10,000000, 0) INSERT INTO deelname_respondent (respondent_id, groep_id, vergoeding, status_bevestigd) VALUES (2, 88, 20,000000, 0) Seems like it should get inserted? the table name: deelname_respondent OK column names: respondent_id, groep_id, vergoeding, status_bevestigd OK Link to comment https://forums.phpfreaks.com/topic/265904-insert-into-fails/ Share on other sites More sharing options...
stijn0713 Posted July 18, 2012 Author Share Posted July 18, 2012 sry, to quick: for people struggling with the same: should have done this: $query2 = "INSERT INTO deelname_respondent (`respondent_id`, `groep_id`, `vergoeding`, `status_bevestigd`) VALUES ('%d', '%d', '%f', '%d')" Link to comment https://forums.phpfreaks.com/topic/265904-insert-into-fails/#findComment-1362458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.