Callum Callum - 1 year ago 111
SQL Question

Medoo - Select issue

Im just starting out building an app with Medoo,

Im trying to run a select query looking like this

$datas = $database->debug()->select(
["email" => ""]

When i run this it uses the query

SELECT "id","password" FROM "table" WHERE "email" = ''

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

Thanks for any help

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download