The below code works well, except for the database insert. I want each
element of the array to be inserted into the database, but only the last
element of the array is inserted... all the elements will echo... any
ideas? I'm a PHP newbie... you can probably tell by the code:
if ($_POST['TOURN_ARRAY'])
{
foreach ($_POST['TOURN_ARRAY'] as $V)
{
echo "Value: $V<br>\n";
$result = "INSERT INTO tb_name (recruit_id, tourn_id) VALUES
('$id', '$V')";
}
if (mysql_query($r esult))
{
echo("It's all good.<br>");
}
else
{
echo("It's all bad: " . mysql_error());
}
}
element of the array to be inserted into the database, but only the last
element of the array is inserted... all the elements will echo... any
ideas? I'm a PHP newbie... you can probably tell by the code:
if ($_POST['TOURN_ARRAY'])
{
foreach ($_POST['TOURN_ARRAY'] as $V)
{
echo "Value: $V<br>\n";
$result = "INSERT INTO tb_name (recruit_id, tourn_id) VALUES
('$id', '$V')";
}
if (mysql_query($r esult))
{
echo("It's all good.<br>");
}
else
{
echo("It's all bad: " . mysql_error());
}
}
Comment