简体   繁体   中英

How can i quickly search a specific id and get all rows of that id in a large database in Laravel with mysql?

I am making a result publishing system application in Laravel . I am importing Large number results (like 1000000) of students in MYSQL database. the student can search there result by role number and registration number. i will give two input and the whole result database needed to be search and find the result of the student .How i should i approach to searching the result so that the search result is found very quickly. thanks

<div class="btn-group">
    <formclass="forminline" action="{{URL::to('searchEmployie')}}" method="get"> 
        <div class="form-group">  
            <input type="text" name="search" class="form-control" id="search" placeholder="{{ trans('app.search_for_action')}}" value="{{Request::get('search')}}"> 
            <button type="submit" class="btn btn-outline btn-default"><i class="icon fa-search" aria-hidden="true"></i></button>

            @if (Request::get('search') != '')
                <a href="{{URL::to('employie')}}" class="btn btn-outline btn-danger" type="button"><i class="icon fa-remove" aria-hidden="true"></i>
                </a>
            @endif
        </div>
    </form>
</div>

controller

$q = Input::get('search');
$employie = Employie::where('employee_name', 'LIKE', '%' . $q . '%')->paginate(2);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM