0

In this case, if I change exp_at, than id_card will be from one field, and exp_at from another.. And if I use where statement for card, than user records disaper. how to solve???

->leftJoin('bon_card', 'bon_card.id_user', '=', 'users.id_user')

->select(DB::raw('max(bon_card.id_card) as id_card, max(bon_card.exp_at) as bon_exp_date, users.*'))

->where([['vards','LIKE',"%{$vards}%"], ['uzvards','LIKE',"%{$uzvards}%"], ['pers_kods','LIKE',"%{$pers_kods}%"], ['tel','LIKE',"%{$tel}%"], ['email','LIKE',"%{$email}%"]])
jedrzej.kurylo
  • 39,591
  • 9
  • 98
  • 107
ivo
  • 1
  • 1
  • 4
    [Little Bobby](http://bobby-tables.com/) says **[you may be at risk for SQL Injection Attacks](https://stackoverflow.com/q/60174/)**. Learn about [Prepared Statements](https://en.wikipedia.org/wiki/Prepared_statement) with [parameterized queries](https://stackoverflow.com/a/4712113/5827005). I recommend `PDO`, which I [wrote a class for](https://github.com/GrumpyCrouton/GrumpyPDO) to make it extremely easy, clean, and more secure than using non-parameterized queries. Also, [This article](http://php.net/manual/en/mysqlinfo.api.choosing.php) may help you choose between `MySQLi` and `PDO` – GrumpyCrouton Oct 16 '17 at 19:15

1 Answers1

0
  ->leftJoin('bon_card', 'bon_card.id_user', '=', 'users.id_user')

->select(DB::raw('max(bon_card.id_card) as id_card, max(bon_card.exp_at) as bon_exp_date, users.*'))

->where([['vards','LIKE',"%{$vards}%"])->orWhere(['uzvards','LIKE',"%{$uzvards}%"])
Aliaga Aliyev
  • 415
  • 1
  • 6
  • 22