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

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

@gabordemooij gabordemooij commented Oct 2, 2016

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

@stijnboa
Copy link
Author

@stijnboa 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants