mardi 18 avril 2017

Unknown column in database by eloquent query

I am creating a criteria for Señor high and tertiary. Im trying to retrieve data that meets the condition but my query resulted to an error.

Example:

If this child is grade 12 and his final grade point average is 85 then this should be converted to college grading system(see conditions).

See the error below.Anyone knows why im getting this error and why saying unknown column even if i dont have such column?

SQLSTATE[42S22]: Column not found: 1054 Unknown column '1.5' in 'where clause' (SQL: select * from scholar_cards where scholar_card_id = 93 and 1.5 between 1.2 and 1.9)

    $count = 0;
    foreach ($card_id as $id) {

        $card = ScholarCard::find($id);
        if ($card->scholar_grade_level == 12) {
            if ($card->scholar_GPA == 100 || $card->scholar_GPA == 99 || $card->scholar_GPA == 98 || $card->scholar_GPA == 97 || $card->scholar_GPA == 96 || $card->scholar_GPA == 95 ) {
             $card_gpa = 1.0;
            }elseif ($card->scholar_GPA == 94) {
                $card_gpa = 1.1;
            }elseif ($card->scholar_GPA == 93) {
                $card_gpa = 1.2;
            }elseif ($card->scholar_GPA == 92) {
                $card_gpa = 1.3;
            }elseif ($card->scholar_GPA == 91) {
                $card_gpa = 1.4;
            }elseif ($card->scholar_GPA == 90) {
                $card_gpa = 1.5;
            }elseif ($card->scholar_GPA == 89) {
                $card_gpa = 1.6;
            }elseif ($card->scholar_GPA == 88) {
                $card_gpa = 1.7;
            }elseif ($card->scholar_GPA == 87) {
                $card_gpa = 1.8;
            }elseif ($card->scholar_GPA == 86) {
                $card_gpa = 1.9;
            }elseif ($card->scholar_GPA == 85) {
                $card_gpa = 2.0;
            }elseif ($card->scholar_GPA == 84) {
                $card_gpa = 2.1;
            }elseif ($card->scholar_GPA == 83) {
                $card_gpa = 2.2;
            }elseif ($card->scholar_GPA == 82) {
                $card_gpa = 2.3;
            }elseif ($card->scholar_GPA == 81) {
                $card_gpa = 2.4;
            }elseif ($card->scholar_GPA == 80) {
                $card_gpa = 2.5;
            }elseif ($card->scholar_GPA == 79) {
                $card_gpa = 2.6;
            }elseif ($card->scholar_GPA == 78) {
                $card_gpa = 2.7;
            }elseif ($card->scholar_GPA == 77) {
                $card_gpa = 2.8;
            }elseif ($card->scholar_GPA == 76) {
                $card_gpa = 2.9;
            }elseif ($card->scholar_GPA == 75) {
                $card_gpa = 3.0;
            }else {
                $card_gpa = 5.0;
            }
        }else{
            $card_gpa = $card->scholar_GPA;
        }
        $scholar_id2s = ScholarCard::where('scholar_card_id','=',$card->scholar_card_id)->whereBetween($card_gpa,[$scholarship->scholarship_gpa_to, $scholarship->scholarship_gpa_from])->get();

        $count++;         
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire