vendredi 3 juin 2016

How to Fetch Data From 2 Tables Using PHP based on Checkbox Selection

I have 2 Tables

  • wll_customer
  • document_checklist

Using following Query I can able to fetch only selected fields(Based on check box selection also i have provided 2 input fields to serch for particular college or student) from wll_customer Table.

$tmp = "SELECT ".implode(",", $sql_columns)." FROM wll_customer WHERE (customer_university = '$university_search' OR customer_name = '$name_search') AND customer_counselor ='".$_SESSION['user_name']."'";

I have two common fields in both table i.e customer_id Primary Key of wll_customer table, and student_id is Foreign key from document_checklist.

How can i Join both the tables?
I managed to fetch only the selected (checked by checkboxes) fields form wll_customer table But, How about i want to fetch some more related fields from document_checklist by joining both the tables.
Any help may greatly appreciated. Thank You!




Aucun commentaire:

Enregistrer un commentaire