Medoo - Select issue

倖福魔咒の 提交于 2019-12-11 10:41:46

问题


Im just starting out building an app with Medoo,

Im trying to run a select query looking like this

$datas = $database->debug()->select(
    "table",
     ["id","password"],
     ["email" => "johndoe@emailaddress.com"]
);

When i run this it uses the query

SELECT "id","password" FROM "table" WHERE "email" = 'johndoe@emailaddress.com'

However this always returns NULL

Inserting to the DB runs correctly, and when I try to run the query generated by medoo directly in mysql CLI it returns a syntax error.

Im struggling to find an issue with the syntax, perhaps maybe the "' quotes?

PHP Version: PHP 5.4.41
MySQL: mysql  Ver 14.14
Medoo: 0.9.8.3

Thanks for any help


回答1:


That could be an issue with requiring ANSI_QUOTES. MySQL has a non-standard setting by default, so you may need to change it.

Normally MySQL uses both types of quotes to delimit strings and backticks for identifiers, whereas the SQL standard is to use double quotes for identifiers and single quotes for strings.

If you change your server setting that should fix it, but be aware that might break every other application that depends on MySQL's strange defaults.



来源:https://stackoverflow.com/questions/30792688/medoo-select-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!