New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findOrCreate string viewed as int #525

Closed
stijnboa opened this Issue Sep 26, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@stijnboa

stijnboa commented Sep 26, 2016

$m = \R::findOrCreate('category', ['code' => (string)$me->menuid]);

// the value of $me->menuid => '00000'

results in query:
SELECTcategory.* FROMcategoryWHERE (codeIN ( 00000 ) )

Which returns all rows where a string is filled in (searches for integer 0)

To fix this the resulting query should be (quotes):

SELECTcategory.* FROMcategoryWHERE (codeIN ( '00000' ) )

Redbean version 4.3

@gabordemooij

This comment has been minimized.

Owner

gabordemooij commented Oct 2, 2016

Thank you for reporting this issue.
I will look into this.

@stijnboa

This comment has been minimized.

stijnboa commented Oct 4, 2016

Thanks!

diego-vieira added a commit to diego-vieira/redbean that referenced this issue Nov 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment