php - Laravel != operator in where not working -


itemprop = "text">

:: Table ('Media_Featured') - & gt; Where ('is_video_of_the_week', 1) - & gt; Where ('video_of_week_expected', '! =', 1) - & gt; first (); Create table 'media_featured` (`id` integer (10) unsigned NULL AUTO_INCREMENT,` media_id` integer (10) unsigned default zero, `is_video_of_the_week` tinyint (1) default zero,` is_featured` tinyint (1) default zero, Time-Ampler faucet default tap, `updated_at` timestamp, zero default faucet, 'deleted_at' timestamp less than zero, primary key (` id`), 'deleted', key 'media_featured_media_id_foreign` (`media_id`), concert Media_firette_media_ad_forrence_food Unji ( `Meedia_aid`) terms 'media' (` Aidi`)) engine = Innodibi Autongrement = 6 default charge = UTF-8 Collet = UTF 8_inikod_si;

A record can be is_video_of_the_week = 1 and video_of_week_expired = zero but the query above provides the null.

Any thoughts?

zero values ​​are not equal to or equal to something else.

Then column! = Zero is always with falsy, column = zero

is a column, to check if zero is required to use zero operator.

In the case of laravel database query generator you can use

  - & gt; whereNull ('video_of_week_expired')   

method

PS: If it is considered video_of_week_expired . If there is a flag-like column, you make it not and 0 / 1 instead of zero Using> / 1

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -