I have this sql query
Code: Select all
<?php
$capacity = $_POST['capacity'];
for ($i=0; $i <count($capacity); $i++)
if (isset($capacity[$i]))
{
$style = $_POST['style'];
for ($x=0; $x <count($style); $x++)
if (isset($style[$x]))
{
$sqlinsertroomcap = "INSERT INTO venuecapacity (venueID,roomID,styleID,capacity) VALUES ('$venueID ','$room','$style[$x]','$capacity[$i]')";
$rsinsertroomcap = mysql_query($sqlinsertroomcap);
}
else
{
}
}
else
{
}
?>the variables come from a "dynamic" form - code extract
Code: Select all
<?php
$sqlstyle = "SELECT * FROM roomstyles";
$rsstyle = mysql_query($sqlstyle);
while ($row = mysql_fetch_array($rsstyle, MYSQL_ASSOC))
{
echo "<div id='col20'>";
echo "<input name='style[]' type='checkbox' value='{$row['roomstyleID']}'> ";
echo $row['roomstyle'];
echo "</div>";
echo "<div id='col25'>";
echo " - Capacity ";
echo "<input name='capacity[]' type='text' size='5'>";
echo "</div>";
echo "<br>";
}
?>But obviously I only want the info entered once into the DB not the "double" - or more dependant upon the number of "style" rows.
Any help please - thanks