dimanche 30 septembre 2018

Unable to get results on many if conditions , i get result only if i run one if statement

Note: i use CodeIgniter framework

I have a big issue when running multiple if statements.

If run the code below the if statement work fine :

    if ($_POST['materialOrder'] != '') {

if ($_POST['materialOrder'] != '') {

            if ($_POST['materialOrder'] != '') {
                $materialOrder = $_POST['materialOrder'];
                $query = $this->db->where("m.material_request_id LIKE '%$materialOrder%'");
            }
        }

The problem come when i run code like below :

        if ($_POST['materialOrder'] != '') {

            if ($_POST['materialOrder'] != '') {
                $materialOrder = $_POST['materialOrder'];
                $query = $this->db->where("m.material_request_id LIKE '%$materialOrder%'");
            }
            if ($materialOrder != "") {
                $materialOrder = $_POST['materialOrder'];
                $query = $this->db->where("l.location_name  LIKE '%$materialOrder%'");
            }
            if ($materialOrder == 'coin' or 'bag') {
                $query = $this->db->where("p.status_name LIKE '%coin%'");
            }
            if ($materialOrder == "round" or 'container') {
                $query = $this->db->where("p.status_name LIKE '%round%'");
            }
        }

i dont get any resuls

Note : if i run each contision like first example i get result for all contision

Aucun commentaire:

Enregistrer un commentaire