Jump to content

mnwuzor

New Members
  • Posts

    3
  • Joined

  • Last visited

mnwuzor's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Dear Jacques1, Thank you so much for your contributions. Regarding using UNIQUE RegNo and Year, the system is build to accept same set of people every year. So if I use UNIQUE feature it will hinder participants from registering in the future. Thats why I am using the RegNo and Year fields to check for duplicate entries per year. Thank you very much for the clean code you wrote our there for me. I have to go back to my study table to update myself on this. Thank you so much
  2. Dear scootstah Thank you so much. I am really grateful. I will test code and get back to you. The form wasnt posting the records to MySQL database. The Year field type is a "year". The Year field is used to filter all validated participants. Validated participants are those that were marked present at the conference. So when the system administrators wants to analyze the attendance, they will use analyze based on the very years event. Now when a participant tries to register twice, the system will check if he has registered earlier. The criteria's for checking are his RegNo and Year of event.
  3. Hello Friends, Please I solicit your kind review. I wrote the code below to help me check for duplicate record entry so my users will not enter same record twice in a year buts the code is neither posting the record not checking if there is any duplicate entries. Here is how the system work. The application on its own allows multiple entries but once in a year. Every year members of a church gather for a conference and the system is used to capture their details. So for every participants, the system will capture their detail for that year once. If a participants details is entered twice the system should check the RegNo and Year fields to be sure the record has not been posted for that year. But its not working Please I need help on this. if(isset($_POST['submit'])) { { $con = mysql_connect('localhost', 'root', '', 'rmwworg_dbms') or die('Error connecting to MySQL server'); $Camp = $_POST['Camp']; $Hostel = $_POST['Hostel']; $Validate = $_POST['Validate']; $Event_Title = $_POST['Event_Title']; $Regno = $_POST['regno']; $Title = $_POST['Title']; $Surname = $_POST['surname']; $OtherNames = $_POST['OtherNames']; $Address = $_POST['Address']; $City = $_POST['City']; $Age = $_POST['Age']; $State = $_POST['State']; $Country = $_POST['Country']; $Assembly= $_POST['Assembly']; $Sex = $_POST['Sex']; $MaritalStatus = $_POST['MaritalStatus']; $Phone = $_POST['Phone']; $Email = $_POST['Email']; $photo2 = $_POST['photo2']; $datetime = $_POST['datetime']; $Year = $_POST['Year']; $validatedby = $_POST['validatdby']; $category = $_POST['category']; $result = mysql_query("SELECT * FROM validatedparticipants WHERE RegNo = '$regno' AND Year = year(now())"); //check for duplicates $num_rows = mysql_num_rows($result); //number of rows where duplicates exist if($num_rows==0) { //if there are no duplicates...insert { $sql="INSERT INTO validatedparticipants (Camp, Hostel, Validate, Event_Title, RegNo, Title, Surname, OtherNames, Address, City, Age, State, Country, Assembly, Sex, MaritalStatus, Phone, Email, photo2, datetime, Year, validatdby, category) VALUES ('$Camp', '$Hostel', '$Validate', '$Event_Title', '$regno', '$Title', '$surname', '$OtherNames', '$Address', '$City', '$Age', '$State', '$Country', '$Assembly', '$Sex', '$MaritalStatus', '$Phone', '$Email', '$photo2', '$datetime','$Year','$validatedby','$category')"; $result1 = mysql_query($con, $sql) or die('Error querying database.'); mysql_close($con); } } else { echo"The Participant added"; } } header("valpartcard.php?RegNo=" . $row_rsValidateParticipant['RegNo'] . ""); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.