Jump to content

[SOLVED] Can't stop this query from looping


subnet_rx

Recommended Posts

elseif ($_POST['event_name'])
{
$event_name = $vbulletin->input->clean_gpc('p', 'event_name', TYPE_NOHTML);
$event_type = $vbulletin->input->clean_gpc('p', 'event_type', TYPE_NOHTML);
$outcomes_no = $vbulletin->input->clean_gpc('p', 'outcomes_no', TYPE_NOHTML);
$db->query_write("INSERT INTO picks_groups (group_title,type) VALUES ('".$db->escape_string($event_name)."','".$db->escape_string($event_type)."')");
$group_id = $db->insert_id();
for($i=1; $i<=$outcomes_no; $i++)
{
	$outcomes[$i] = $vbulletin->input->clean_gpc('p', 'outcome[$i]', TYPE_NOHTML);
}
for($i=1, $i<=$outcomes_no; $i++
{
$db->query_write("INSERT INTO picks_items (group_id, item_title) VALUES ('".$db->escape_string($group_id)."','".$db->escape_string($outcomes[$i])."')");
}
}

 

For some reason, my script times out trying to insert as many items as possible into the database on this specific line. 

for($i=1, $i<=$outcomes_no; $i++
{
$db->query_write("INSERT INTO picks_items (group_id, item_title) VALUES ('".$db->escape_string($group_id)."','".$db->escape_string($outcomes[$i])."')");
}

$outcomes_no is equal to 02.  I checked it by echoing it, and it still will put 600,000+ items into the db.  Anyone know what is going on?

Link to comment
https://forums.phpfreaks.com/topic/66937-solved-cant-stop-this-query-from-looping/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.