devio
devio

Reputation: 1169

Query issue using Doctrine2 : Error: Expected end of string, got '.'

I'm trying to build a query using Doctrine2 QueryBuilder, but this is what I get :

[Syntax Error] line 0, col 69: Error: Expected end of string, got '.'

Here's the query :

SELECT value FROM Stats\MESBundle\Entity\Valeur V WHERE code = SE.ENR.PRIM.FM.ZS

I think the problem is that SE.ENR.PRIM.FM.ZS contains dots. But I can't change this code. Thus, I have to find a way to solve this without changing the code (which is a variable actually : $code).

Upvotes: 0

Views: 4450

Answers (2)

anotherdev
anotherdev

Reputation: 2569

With Mysql, when you use strings, you have to write it between two double-quotes.

The following code should work:

SELECT value FROM Stats\MESBundle\Entity\Valeur V WHERE code = "SE.ENR.PRIM.FM.ZS"

Upvotes: 1

Jannic Beck
Jannic Beck

Reputation: 2425

try

SELECT value FROM Stats\MESBundle\Entity\Valeur V WHERE code = 'SE.ENR.PRIM.FM.ZS'

Upvotes: 0

Related Questions