Skip to content
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
Closed

findOrCreate string viewed as int #525

stijnboa opened this issue Sep 26, 2016 · 2 comments

Comments

@stijnboa
Copy link

$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
Copy link
Owner

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

@stijnboa
Copy link
Author

stijnboa commented Oct 4, 2016

Thanks!

dv336699 pushed a commit to dv336699/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
Projects
None yet
Development

No branches or pull requests

2 participants