Bilalfarhat24's avatar

Comparing two columns value

How to compare the values of two columns of two different table? For Example: If the table, Person detail has "Bank Challan No" column and Bank Detail also has "Bank Challan No" column.... when user submit the form, Challan No save into the Person detail table, and system will generate the Challan form for User to submit fees in bank. After user submit the fees into bank, Bank will send the daily transaction details to the System Admin. System Admin will enter the "Challan No" into BankChallan No of Bank Detail Column. Then I want to show all Person Details who have submitted the fees by comparing "Bank Challan No" of Person Detail and "Bank Challan No" of Bank Detail . And everyone can see this list.... How i can do this??

0 likes
8 replies
mstnorris's avatar

Woah @Bilalfarhat24 ...

How to compare the values of two columns of two different table?

return $tableOne->columnName == $tableTwo->columnName ? 'yes' : 'no';

For Example: If the table, Person detail has "Bank Challan No" column and Bank Detail also has "Bank Challan No" column.... when user submit the form, Challan No save into the Person detail table, and system will generate the Challan form for User to submit fees in bank.

if (Bank::where('challanNo', '=', Input::get('challanNo'))->exists()) {
   // the record was found so do whatever here
  // submit the fees etc
}

After user submit the fees into bank, Bank will send the daily transaction details to the System Admin.

This is not comparing two values in the database. Look into Events

System Admin will enter the "Challan No" into BankChallan No of Bank Detail Column.

You need to set up a relationship between a Person and a Bank based on the foreign key of 'Bank Challan No'. See Relationships

Then I want to show all Person Details who have submitted the fees by comparing "Bank Challan No" of Person Detail and "Bank Challan No" of Bank Detail . And everyone can see this list.... How i can do this??

Let's get a few things straight. Please slow down and split up your question (as I have) into the relevant, smaller parts. Don't run before you can walk. What have you tried so far?

1 like
Bilalfarhat24's avatar

@mstnorris I have not doing work on this yet. First, I want to get ideas from you guys. And then i will start working on this.

mstnorris's avatar

From personal experience it is best to start something, try it out, see how you get on and if/when you get stuck, then ask questions and show us what you've done.

If you just follow what someone else tells you to do, you will never learn, and you won't understand in the long run.

2 likes
Kemito's avatar

If you only do what you can do, you will never be more than you are now.

1 like
Bilalfarhat24's avatar

@Kemito @mstnorris I have done the following thing:-

  1. User submit the form and Challan No save into Personal Detail table, it generate challan form for user to submit fees in bank..
  2. Admin add the Challan No to Bank Detail table.
  3. Both table have Relationship.. The only thing i want to know from you guys is, How to show the list of users how have submit the fees?? something like this e.g if challan no of personal detail = challan no of bank list, it show the personal details of users who submitted fees..

Please or to participate in this conversation.