Support the ongoing development of Laravel.io →
Database Installation Configuration

is there any difference between ubuntu desktop vs homestead? because when i query using where clause like where('id',1) on my ubuntu desktop I couldnt get the data while on the homestead I can. but when i add quote on my code like where('id','1'), I can now get the data on my ubuntu desktop. is there any problem with my php installation and btw, im also using the repository used by homestead php but i have the latest version of it.

the workaround for now is using laravel's model casting. I set the attribute to integer so I will no longer put quote on the variable on where clause.

Imgur

it will always return string on my query.

ok. I got it guys. you need to install php5-mysqlnd extension. :D

Last updated 3 years ago.
0

this is few times i have seen this error crop up.. how weird.. I know that is not super helpful but do search around here & i can see if i can find other threads that may contain some solution

0

shez1983 said:

this is few times i have seen this error crop up.. how weird.. I know that is not super helpful but do search around here & i can see if i can find other threads that may contain some solution

I hope you can help me with this.

0

I believe this is due to mysql "Strict Mode". Please research it on the web.

The recent releases of mysql have mysql_mode set to "STRICT_TRANS_TABLES" by default. This holds for your ubuntu install.

Homestead mysql explicitly sets the mysql_mode to "". This relaxes several database rules relating to casting and null checks.

Note that laravel now offers a config flag in database.php->mysql named "strict" that defaults to false. You can set it to true to have laravel generate sql that plays nice with strict mode.

Hope this helps!

0

mnshankar said:

I believe this is due to mysql "Strict Mode". Please research it on the web.

The recent releases of mysql have mysql_mode set to "STRICT_TRANS_TABLES" by default. This holds for your ubuntu install.

Homestead mysql explicitly sets the mysql_mode to "". This relaxes several database rules relating to casting and null checks.

Note that laravel now offers a config flag in database.php->mysql named "strict" that defaults to false. You can set it to true to have laravel generate sql that plays nice with strict mode.

Hope this helps!

doesnt work :(

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

cargie cargie Joined 28 Jul 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.