mardi 4 juillet 2017

compare values and update specific cell in a database via laravel

This is the '$key=>$sec' array displayed (request()->all()) Am not able to compare the $i value with the "key" of $array value for it to enter into the if block. I have stored the specific cell location which am willing to update in the $value (am not sure if it's the correct way) either way i fail to write an update statement after it, to update that location by incrementing it by 1. I know these might be very basic questions but am new to this framework , please help !

Checkbox declaration in views .

                            <div class = "form-group">
                            <input tabindex="1" type="checkbox"  name=""  />
                            </div>

In controller:

 foreach ($columns as $col)
            {
                    //dd("Y");
                    if($col == $txt[1])
                    {
                            $got=DB::table($req)->select($col)->get();
                            //dd(request()->all());
                            $i=0;
                            foreach($got as $g)
                            {
                                    $arr= request()->all();
                                    dd($arr);
        //comparing value         if($i==$arr)
                                    {
                                    //dd("checked");
                                    $value=DB::table($req)-
>where('Class_Roll',$i+1)->pluck($txt[1]);

//UPDATE STATEMENT OF THAT SPECIFIC CELL BY +1.
                                    $i++;
                                    dd("done");
                                    }
                                    else
                                            $i++;
                            }
                            dd($i);
                    }
            }



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2smFE7g
via IFTTT

Aucun commentaire:

Enregistrer un commentaire