well first off I noticed you redirect the user upon success, then try to run a fourth query after that. The fourth query will never run if the first 3 are successful, because the script redirects the user on success.
I rewrote your code (parse errors and a missing bracket here and there you'll need to workout as I'm sure I've missed some) and embedded your query's within if statements. So if #1 is successful, #2 runs, and if #2 is successful, then #3 runs, and if #3 is successful, then #4 runs, and if #4 is successful, the user is then redirected.
I also added a line to print the query string in the case of a failed insert. This will allow you to see exactly what is happening. Once you have your script working you can delete or comment out.
<?php
if (isset($_POST["art_name"]))
{
db();
man();
mysql_query('LOCK TABLES tblAgents READ, tblArtsits READ, tblBandGenre READ');
// ARTIST INFO
$art_name = $_POST["art_name"];
$description = $_POST["description"];
$art_site = $_POST["art_site"];
$promo = $_POST["promo"];
$avail_dates = $_POST["avail_m"] . " - " . $_POST["avail_y"];
$avail_d = $_POST["avail_d"];
$genre = $_POST["genre"];
$strSQL = "INSERT INTO tblArtists (art_name, description, promo_pack, art_site, avail_dates, avail_detail) VALUES('$art_name', '$description', '$promo', '$art_site', '$avail_dates', '$avail_d')";
if (!@mysql_query($strSQL))
{
die('Could not enter artist information at this time, please try again later ' . mysql_error());
print "Query String: " . $strSQL . "<br />\n"; // Delete this later -- only for development
}
else
{
// #1 was successful. Run #2
// PLACE IN GENRE
$art_id = mysql_insert_id();
$strSQL2 = "INSERT INTO tblBandGenre (art_id, genre_id) VALUES('$art_id', '$genre')";
if (!@mysql_query($strSQL2))
{
die('Could not enter band into genre category at this time, please try again later ' . mysql_error());
print "Query String2 " . $strSQL2 . "<br />\n"; // Delete later
}
else
{
// #2 was successful. Run #3
// AGENT INFO
$ag_fname = $_POST["ag_fname"];
$ag_lname = $_POST["ag_lname"];
$ag_email = $_POST["ag_email"];
$ag_address = $_POST["ag_address"];
$ag_city = $_POST["ag_city"];
$ag_st = $_POST["ag_st"];
$ag_zip = $_POST["ag_zip"];
$ag_phone = $_POST["ag_phone"];
$ag_ext = $_POST["ag_ext"];
$strSQL3 = "INSERT INTO tblAgents (ag_fname, ag_lname, ag_email, ag_address, ag_city, ag_st, ag_zip, ag_phone, ag_ext)
VALUES('$aq_fname', '$ag_lname', '$ag_email', '$ag_address', '$ag_city', '$ag_st', '$ag_zip', '$ag_phone', '$ag_ext')";
if (@mysql_query($strSQL3))
{
die('Could not contact information at this time, please try again later ' . mysql_error());
print "Query String3 " . $strSQL3 . "<br />\n";
}
else
{
// #3 was successful. Run #4
// ASSOCIATE AGENT WITH BAND
$ag_id = mysql_insert_id();
$strSQL4 = "INSERT INTO tblArtAgent (art_id, ag_id) VALUES('$art_id', '$ag_id')";
if (!@mysql_query($strSQL4))
{
die('Could not add agent to band at this time, please try again later ' . mysql_error());
print "Query String4: " . $strSQL4 . "<br />\n";
}
else
{
#4 was successful. Redirect user to index.
mysql_query('UNLOCK TABLES');
header( 'Location: index.htm?thanks' );
}
}
}
}
}
else
{
// SHOW ENTRY FORM
}
?>