K
K
Konstantin Spirin2020-12-07 12:06:15
Yii
Konstantin Spirin, 2020-12-07 12:06:15

How to create sql query with > or < condition and using variable at the same time in yii2?

example in sql php:

$query = "SELECT * FROM `product` where  price >'$nahzap'";

on yii2
$query = Product::find()->where(['price' =$nahzap]);

This is if it is equal, but how to make it more or less?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lander, 2020-12-07
@usdglander

I don’t remember exactly, it was a long time ago, but it was done something like this:

$query = Product::find()->where(['>', 'price', $nahzap]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question