Plazman65 Posted April 12, 2006 Share Posted April 12, 2006 Good Morning, I am trying to get this page to work. What I need to do is,if members exceed the amount entered it stopps processing and says "you have succeeded the number of.."then if it goes past that but it they already have that job in their favorites for it to say " hey you its already in there" and then if it goes past that then goes ahead and enters inserts the data.It doing everything but the unique job part. Does anyone see whats wrong?I appreciate the help. Thanks, Michelle <form action="<?php echo $editFormAction; ?>" method="POST" name="form1" class="style1" id="form1"> <?php $editFormAction = $_SERVER['PHP_SELF'];if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);}if(($_SESSION['mem_type']=="standard" && $_SESSION['count']>=5)|| ($_SESSION['mem_type']=="silver" && $_SESSION['count']>=10)|| ($_SESSION['mem_type']=="gold" && $_SESSION['count']>=25)){ echo "You have exceeded your maximum number of Departments. ". "Please edit your departments or consider upgrading your account.";}else$st = mysql_query("SELECT ,username,depid FROM mydepartments WHERE depid = '$posted_depid' AND username='MM_Username'");$recs = mysql_num_rows($st);$row = mysql_fetch_array($st);if ($recs >=1)echo "You already have this department in your favorites";elseif ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO mydepartments (username, depid, mem_type) VALUES (%s, %s, %s)", GetSQLValueString($_POST['username2'], "text"), GetSQLValueString($_POST['depid2'], "int"), GetSQLValueString($_POST['textfield'], "text")); mysql_select_db($database_jobs, $jobs); $Result1 = mysql_query($insertSQL, $jobs) or die(mysql_error()); if (isset($_SERVER['QUERY_STRING'])) echo"Your department has been successfully added."; } ?> Quote Link to comment Share on other sites More sharing options...
obsidian Posted April 12, 2006 Share Posted April 12, 2006 actually, i think it's simply a matter of misplaced curly brackets. try this and see if it helps:[code]<?php$editFormAction = $_SERVER['PHP_SELF'];if (isset($_SERVER['QUERY_STRING'])) $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);if (($_SESSION['mem_type']=="standard" && $_SESSION['count']>=5) || ($_SESSION['mem_type']=="silver" && $_SESSION['count']>=10) || ($_SESSION['mem_type']=="gold" && $_SESSION['count']>=25)) } echo "You have exceeded your maximum number of Departments. ". "Please edit your departments or consider upgrading your account.";} else { $st = mysql_query("SELECT ,username,depid FROM mydepartments WHERE depid = '$posted_depid' AND username='MM_Username'"); $recs = mysql_num_rows($st); $row = mysql_fetch_array($st); if ($recs >=1) echo "You already have this department in your favorites"; elseif ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO mydepartments (username, depid, mem_type) VALUES (%s, %s, %s)", GetSQLValueString($_POST['username2'], "text"), GetSQLValueString($_POST['depid2'], "int"), GetSQLValueString($_POST['textfield'], "text")); mysql_select_db($database_jobs, $jobs); $Result1 = mysql_query($insertSQL, $jobs) or die(mysql_error()); if ($Result1) echo"Your department has been successfully added."; }}?>[/code]i really haven't changed any code, just cleaned it up a little Quote Link to comment Share on other sites More sharing options...
Plazman65 Posted April 13, 2006 Author Share Posted April 13, 2006 Thanks for your help, If the number of jobs exceeds then it says hey you cant do that , if its added it says its added. The checking for unique part though it isnt catching that. Any ideas?Thanks, Michelle Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.