-1

When trying to run this code in Zend 2 with doctrine 2 with this Script :

$query = $entityManager->createQuery('SELECT u FROM  \Synchro\Entity\Group u WHERE u.namegroup=:namegroup');
            $query->setParameters(array(
                    'namegroup' =>$nameGroup
                    ));

$datagroup['nameGroup'] = "Group_".$companyinfo['cprenom']."".$companyinfo ['cnom'];

i get this Error :

SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe près de 'group g0_ WHERE g0_.nameGroup = 'GroupPETIT'' à la ligne 1

i ver_dumped the $nameGroup i get string 'GroupPETIT', how can i resolved that Thanks in advance

mari roza
  • 27
  • 2
  • 7
  • Please try to provide as much details to your question as possible: a) more than one line of code (e.g. how is it used, where is the sql query submitted), b) the contents of the `$companyinfo` variable and others shown in your example c) which database & frameworks you are using. – Fge Apr 01 '16 at 18:10
  • paste here your $query->getQuery()->getSQL() result, at least. – Greco Jonathan Apr 06 '16 at 11:32

1 Answers1

0

It looks like $companyinfo ['cprenom'] is an array. Trying dumping it, and also there is space between $companyInfo and ['cprenom']. Hope there is no space in the code.

Pradeep
  • 2,469
  • 1
  • 18
  • 27
  • i Have always This Error:SQLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe près de 'group g0_ WHERE g0_.nameGroup = 'GroupPETIT'' i do this query in doctrine i used Zend 2 :$query = $entityManager->createQuery('SELECT u FROM \Synchro\Entity\Group u WHERE u.namegroup=:namegroup'); $query->setParameters(array( 'namegroup' =>$nameGroup ));how can i resolve this Issue thanks in advance – mari roza Apr 02 '16 at 10:05