kevgais Posted May 22, 2008 Share Posted May 22, 2008 hi, I have this sql statement on form.php, thanks to this forum. I want to amend it but am having trouble understanding it. The form prior to this creates 2 empty textboxes on the fly. I need to insert the same random number into the 'id' field next to every record inserted in the below statement. Any ideas? $sql.="INSERT INTO guests (guest_name, guest_email, event_id) VALUES"; for($i=0;$i<sizeof($_POST['username']);$i++){ $sql.="('".mysql_real_escape_string($_POST['username'][$i])."','".mysql_real_escape_string($_POST['email'][$i])."','".mysql_real_escape_string($_POST['id'][$i)."')"; if(!$i==sizeof($_POST['username'])){ $sql.=","; } } Link to comment https://forums.phpfreaks.com/topic/106800-break-down-my-sql-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.