Ok I have a form with a listbox that you can add too along with checkboxes.
Basically I am doing a check to see if the item in the listbox is in the table if its not then do nothing but if it is then do a delete. Now after that I do a insert with what data pertains in the check boxes....so I need to know why my submit page does nothing with this nested query run.
<?
session_start();
if(empty($_SESSION['user_name'])) {
die('An error has ocurred. It may be that you have not logged in, or that your session has expired.
Please try <a href="login.php">logging in</a> again or contact the
<a href="mailto:admin@example.com">system administrator</a>');
}
include '../connection.php';
$pid = $_POST['pid'];
$sid = $_POST['sid'];
$auddates = $_POST['auddates'];
//Check if Date is in table.
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
$query = "SELECT atid from msa_auditionsdatetimes WHERE atid = ".$auddates."";
$result = mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result) or die(mysql_error());
$u = 0;
while ($u < $num) {
if ($num == 0)
{
}
else
{
$query = "DELETE FROM msa_auditionsdatetimes WHERE atid = ".$auddates."";
echo $query;
//execute query
//$result = mysql_query($query2) or die ("Error in query: $query. ".mysql_error());
}
++$u;
}
for($i = 1; $i < 29; $i++) {
If (empty($_POST['audtimes_'.$i])) {
} else {
// create query
$query = "INSERT INTO msa_auditionsdatetimes (aid, atid) VALUES (".$auddates.", ".$_POST['audtimes_'.$i].")";
echo $query;
// execute query
//$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
}
}
// close connection
mysql_close($connection);
//echo "<script LANGUAGE=JavaScript> self.location=\"auddates.php?pid=".$pid."&sid=".$sid."&aid=".$auddates."\";</script>";
?>
any ideas or did I lose you?