Hi,
I am getting this Error:
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You
have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near
'erstelleAuswahl' at line 1
When I am trying to retrieve some data of my database.
Here is my function in KundenController.php
public function erstelleAuswahl() {
$this->Kunde->recursive = -1;
$fields = array('Kunde.id', 'Kunde.anrede_id',
'Kunde.vorname', 'Kunde.nachname', 'Kunde.name');
$conditions = array('Kunde.gruppen_id' => $this->Auth-
>user('gruppen_id'));
$kundenliste = $this->Kunde->find('all', array('fields' =>
$fields, 'conditions' => $conditions));
foreach($kundenliste as $kunde) {
if($kunde['Kunde']['anrede_id'] == 'FA') {
$kunden[$kunde['Kunde']['id']] = $kunde['Kunde']
['name'];
} else {
$kunden[$kunde['Kunde']['id']] = $kunde['Kunde']
['nachname'].' '.$kunde['Kunde']['vorname'];
}
}
return $kunden;
//print_r($kunden);
}
And if I am calling this function to get the array, I always get the
error.
I have debugged the SQL query, here it is:
SELECT `Kunde`.`id`, `Kunde`.`anrede_id`, `Kunde`.`vorname`,
`Kunde`.`nachname`, `Kunde`.`name` FROM `mweb`.`kunden` AS `Kunde`
WHERE `Kunde`.`gruppen_id` = 1
If I run this query in phpMyAdmin I get my data.
So I have no Idea, what's the problem.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php