Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7749327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:01:09+00:00 2026-06-01T11:01:09+00:00

My system is base on driving permit application. Where users can apply for different

  • 0

My system is base on driving permit application. Where users can apply for different level of permit, for example if user want to apply for class 5 permit, they must have pre requisites of class 2 and 3.

In my database, i have 2 related tables, 1 is the permit where it stores all the permit that users have applied for or is waiting for approval. The other table is the description of the permit type where it indicates each available permit that users can apply for together with its pre-requisites and description.

permit ( PID,EID, PTYPE,STATUS,DATETIMEAPP)

type (TYID,PTYPE, PREREQ1, PREREQ2, REQEXP, DES)

My plan is to retrieve data from the database

$query= "select PTYPE from permit where eid = $user"
$result = mysql_query($query, $conn);

Store the result as an array

while ($row = mysql_fetch_assoc($result))
{
    $result_array[] = $row;
}

retrieve the pre requites from the type table

$query= "select PREREQ1 , PREREQ2 from type where TYID = $appliedPermit"
$result = mysql_query($query, $conn);

Compare the 2 results together with a boolean ( I not sure how can i code this)

If result is true then proceed else return to previous page with a pop up to inform user that they have not met pre-requisites. ( i know i need the if else statement but not sure how to write the condition)

Do you guys think that i am on the right path?? I am not sure if it will work…but hope any one here have a better suggestion.

Restructure a little:

My system aims to allow users to apply for driving permit…there are a total of 9 permits -Class 1, Class 2, Class 3. Cat 2PG, Cat 3PG, Car4PG, Cat 1OR, Cat 2OR, Cat 3OR, Cat 2TT and Cat 3TT. For example Cat 3TT require users to have Cat 2TT and Cat 2PG. in another words, the pre-requisites of Cat 3TT is Cat 2TT and Cat 2PG.

I would like to use PHP to draw all the required values from the database and compare them to see if the user have met the pre-requsites before allowing him to proceed to the medical questionnaire if he haven got 1.

The Problem is: I do not know how to code it out logically, I tried but it did not work. Hoping to get more opinions and solutions to my problem. Thank You very much. Help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:01:11+00:00Added an answer on June 1, 2026 at 11:01 am

    You can check the prerequisites in only one query :

    $query = "SELECT t.tyid, t.prereq1, t.prereq2
    , (CASE WHEN (t.prereq1 IS NOT NULL) AND (p1.ptype IS NULL) THEN 1 ELSE 0 END) AS missing1
    , (CASE WHEN (t.prereq2 IS NOT NULL) AND (p2.ptype IS NULL) THEN 1 ELSE 0 END) AS missing2
    FROM type AS t
    LEFT JOIN permit AS p1 ON (t.prereq1=p1.ptype) AND ( p1.eid = $user )
    LEFT JOIN permit AS p2 ON (t.prereq2=p2.ptype) AND ( p2.eid = $user )
    WHERE ( t.tyid IN (".implode(',', $appliedPermit).") )";
    
    $result = mysql_query($query, $conn);
    while ($row = mysql_fetch_assoc($result)) {
      echo "permit ".$row['tyid']. " : "
      echo "prerequisites = ".$row['prereq1'].", ".$row['prereq2'];
      if ( ($row['missing1']==1) && ($row['missing1']==1) ) {
        echo ", result = ok <br>";
      } else {
        echo ", result = failed <br>";
      }
    }
    

    This query returns the two prerequisites id ; but also missing1 value is 1 if prerequisite #1 is missing, and missing2 value is 1 if prerequisite #2 is missing.

    Note: I’ve updated my post to reply to your two comments below.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say we have a derivided class SerializableLabel from the base class System.Windows.Controls. [XmlRoot(SerializableLabel)]
System.Array serves as the base class for all arrays in the Common Language Runtime
I have a base class Parent like this: using System; using System.Collections.Generic; using System.Text;
using System; namespace random { interface IHelper { void HelpMeNow(); } public class Base
Please refer to the Java code below: class Base{ Base(){ System.out.println(Base Constructor); method(); }
does anybody know any css grid system with Base 980px Grid and Base 1003
Delphi 2009 introduced a hierarchical system for project options configuration, where you set base
Have someone used with success TRAC ticketing + wiki system accessing a code base
In this question the OP implies that he wants to base the blog system
I have distributed data base system and in my project data base connection string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.