Database 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 MariaDB server version for the right syntax to use near '*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/1' at line 1
SQL Query:
SELECT `Ville`.`nom`, `Ville`.`slug`, (((acos(sin((*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/180)) * cos(((- Ville.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344*1000) as distance FROM `c2_1001ecolesprivees_db`.`villes` AS `Ville` LEFT JOIN `c2_1001ecolesprivees_db`.`etablissements` AS `Etablissement` ON (`Etablissement`.`ville_id` = `Ville`.`id`) WHERE `Ville`.`slug` != "breze" AND agregat_id = 1 GROUP BY `Ville`.`id` HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1 ORDER BY `distance` ASC LIMIT 7
Notice:
If you want to customize this error message, create app/View/Errors/pdo_error.ctp
Stack Trace
- CORE/Cake/Model/Datasource/DboSource.php line 458 → PDOStatement->execute(array)
try {
$query = $this->_connection->prepare($sql, $prepareOptions);
$query->setFetchMode(PDO::FETCH_LAZY);
if (!$query->execute($params)) {
$this->_results = $query;
- CORE/Cake/Model/Datasource/DboSource.php line 424 → DboSource->_execute(string, array)
$options += array('log' => $this->fullDebug);
$t = microtime(true);
$this->_result = $this->_execute($sql, $params);
'SELECT `Ville`.`nom`, `Ville`.`slug`, (((acos(sin((*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/180)) * cos(((- Ville.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344*1000) as distance FROM `c2_1001ecolesprivees_db`.`villes` AS `Ville` LEFT JOIN `c2_1001ecolesprivees_db`.`etablissements` AS `Etablissement` ON (`Etablissement`.`ville_id` = `Ville`.`id`) WHERE `Ville`.`slug` != "breze" AND agregat_id = 1 GROUP BY `Ville`.`id` HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1 ORDER BY `distance` ASC LIMIT 7'
array()
- CORE/Cake/Model/Datasource/DboSource.php line 666 → DboSource->execute(string, array, array)
if ($cache && ($cached = $this->getQueryCache($sql, $params)) !== false) {
return $cached;
}
$result = $this->execute($sql, array(), $params);
if ($result) {
'SELECT `Ville`.`nom`, `Ville`.`slug`, (((acos(sin((*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/180)) * cos(((- Ville.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344*1000) as distance FROM `c2_1001ecolesprivees_db`.`villes` AS `Ville` LEFT JOIN `c2_1001ecolesprivees_db`.`etablissements` AS `Etablissement` ON (`Etablissement`.`ville_id` = `Ville`.`id`) WHERE `Ville`.`slug` != "breze" AND agregat_id = 1 GROUP BY `Ville`.`id` HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1 ORDER BY `distance` ASC LIMIT 7'
array()
array()
- CORE/Cake/Model/Datasource/DboSource.php line 1106 → DboSource->fetchAll(string, boolean)
// Build SQL statement with the primary model, plus hasOne and belongsTo associations
$query = $this->buildAssociationQuery($Model, $queryData);
$resultSet = $this->fetchAll($query, $Model->cacheQueries);
unset($query);
'SELECT `Ville`.`nom`, `Ville`.`slug`, (((acos(sin((*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/180)) * cos(((- Ville.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344*1000) as distance FROM `c2_1001ecolesprivees_db`.`villes` AS `Ville` LEFT JOIN `c2_1001ecolesprivees_db`.`etablissements` AS `Etablissement` ON (`Etablissement`.`ville_id` = `Ville`.`id`) WHERE `Ville`.`slug` != "breze" AND agregat_id = 1 GROUP BY `Ville`.`id` HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1 ORDER BY `distance` ASC LIMIT 7'
false
- CORE/Cake/Model/Model.php line 2947 → DboSource->read(Ville, array)
* @return array
*/
protected function _readDataSource($type, $query) {
$results = $this->getDataSource()->read($this, $query);
$this->resetAssociations();
object(Ville) {
belongsTo => array(
[maximum depth reached]
)
validate => array(
[maximum depth reached]
)
recursive => (int) -1
actsAs => array(
[maximum depth reached]
)
useDbConfig => 'default'
useTable => 'villes'
id => false
data => array([maximum depth reached])
schemaName => 'c2_1001ecolesprivees_db'
table => 'villes'
primaryKey => 'id'
validationErrors => array([maximum depth reached])
validationDomain => null
tablePrefix => ''
plugin => null
name => 'Ville'
alias => 'Ville'
tableToModel => array(
[maximum depth reached]
)
cacheQueries => false
hasOne => array([maximum depth reached])
hasMany => array([maximum depth reached])
hasAndBelongsToMany => array([maximum depth reached])
Behaviors => object(BehaviorCollection) {}
whitelist => array([maximum depth reached])
cacheSources => true
findQueryType => 'all'
order => null
virtualFields => array([maximum depth reached])
__backAssociation => array([maximum depth reached])
__backInnerAssociation => array([maximum depth reached])
__backOriginalAssociation => array([maximum depth reached])
__backContainableAssociation => array([maximum depth reached])
__safeUpdateMode => false
findMethods => array(
[maximum depth reached]
)
[protected] _schema => array(
[maximum depth reached]
)
[protected] _associationKeys => array(
[maximum depth reached]
)
[protected] _associations => array(
[maximum depth reached]
)
[protected] _insertID => null
[protected] _sourceConfigured => true
[protected] _eventManager => object(CakeEventManager) {}
[protected] _validator => null
}
array(
'conditions' => 'Ville.slug != "breze" AND agregat_id = 1',
'fields' => 'Ville.nom,Ville.slug,(((acos(sin((*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/180)) * cos(((- Ville.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344*1000) as distance',
'joins' => array(
(int) 0 => array(
[maximum depth reached]
)
),
'limit' => (int) 7,
'offset' => null,
'order' => array(
(int) 0 => 'distance'
),
'page' => (int) 1,
'group' => 'Ville.id HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1',
'callbacks' => true
)
- CORE/Cake/Model/Model.php line 2919 → Model->_readDataSource(string, array)
return null;
}
return $this->_readDataSource($type, $query);
}
'all'
array(
'conditions' => 'Ville.slug != "breze" AND agregat_id = 1',
'fields' => 'Ville.nom,Ville.slug,(((acos(sin((*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/180)) * cos(((- Ville.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344*1000) as distance',
'joins' => array(
(int) 0 => array(
[maximum depth reached]
)
),
'limit' => (int) 7,
'offset' => null,
'order' => array(
(int) 0 => 'distance'
),
'page' => (int) 1,
'group' => 'Ville.id HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1',
'callbacks' => true
)
- APP/Controller/AgregatsController.php line 219 → Model->find(string, array)
'group' => 'Ville.id HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1',
'order' => 'distance',
'limit' => 7
));
'all'
array(
'fields' => 'Ville.nom,Ville.slug,(((acos(sin((*pi()/180)) * sin((Ville.lat*pi()/180))+cos((*pi()/180)) * cos((Ville.lat*pi()/180)) * cos(((- Ville.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344*1000) as distance',
'joins' => array(
(int) 0 => array(
[maximum depth reached]
)
),
'conditions' => 'Ville.slug != "breze" AND agregat_id = 1',
'group' => 'Ville.id HAVING distance < 50000 and COUNT(`Ville`.`slug`) > 1',
'order' => 'distance',
'limit' => (int) 7
)
- [internal function] → AgregatsController->index(string, string)
- CORE/Cake/Controller/Controller.php line 490 → ReflectionMethod->invokeArgs(AgregatsController, array)
'action' => $request->params['action']
));
}
return $method->invokeArgs($this, $request->params['pass']);
object(AgregatsController) {
helpers => array(
[maximum depth reached]
)
components => array(
[maximum depth reached]
)
name => 'Agregats'
uses => array(
[maximum depth reached]
)
request => object(CakeRequest) {}
response => object(CakeResponse) {}
viewPath => 'Agregats'
layoutPath => null
viewVars => array(
[maximum depth reached]
)
view => 'index'
layout => 'default'
autoRender => true
autoLayout => true
Components => object(ComponentCollection) {}
viewClass => 'View'
View => null
ext => '.ctp'
plugin => null
cacheAction => false
passedArgs => array(
[maximum depth reached]
)
scaffold => false
methods => array(
[maximum depth reached]
)
modelClass => 'Agregat'
modelKey => 'agregat'
validationErrors => null
AutoLogin => object(AutoLoginComponent) {}
Auth => object(AuthComponent) {}
RequestHandler => object(RequestHandlerComponent) {}
Session => object(SessionComponent) {}
Img => object(ImgComponent) {}
Paginator => object(PaginatorComponent) {}
Post => object(Post) {}
Agregat => object(Agregat) {}
Etablissement => object(Etablissement) {}
Departement => object(Departement) {}
Region => object(AppModel) {}
Ville => object(Ville) {}
[protected] _responseClass => 'CakeResponse'
[protected] _mergeParent => 'AppController'
[protected] _eventManager => object(CakeEventManager) {}
}
array(
(int) 0 => '1',
(int) 1 => 'ecoles'
)
- CORE/Cake/Routing/Dispatcher.php line 191 → Controller->invokeAction(CakeRequest)
$response = $controller->response;
$render = true;
$result = $controller->invokeAction($request);
if ($result instanceof CakeResponse) {
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array([maximum depth reached])
url => 'annuaire/1-ecoles/ville:breze'
base => ''
webroot => '/'
here => '/annuaire/1-ecoles/ville:breze'
[protected] _detectors => array(
[maximum depth reached]
)
[protected] _input => ''
}
- CORE/Cake/Routing/Dispatcher.php line 165 → Dispatcher->_invoke(AgregatsController, CakeRequest)
));
}
$response = $this->_invoke($controller, $request);
if (isset($request->params['return'])) {
object(AgregatsController) {
helpers => array(
[maximum depth reached]
)
components => array(
[maximum depth reached]
)
name => 'Agregats'
uses => array(
[maximum depth reached]
)
request => object(CakeRequest) {}
response => object(CakeResponse) {}
viewPath => 'Agregats'
layoutPath => null
viewVars => array(
[maximum depth reached]
)
view => 'index'
layout => 'default'
autoRender => true
autoLayout => true
Components => object(ComponentCollection) {}
viewClass => 'View'
View => null
ext => '.ctp'
plugin => null
cacheAction => false
passedArgs => array(
[maximum depth reached]
)
scaffold => false
methods => array(
[maximum depth reached]
)
modelClass => 'Agregat'
modelKey => 'agregat'
validationErrors => null
AutoLogin => object(AutoLoginComponent) {}
Auth => object(AuthComponent) {}
RequestHandler => object(RequestHandlerComponent) {}
Session => object(SessionComponent) {}
Img => object(ImgComponent) {}
Paginator => object(PaginatorComponent) {}
Post => object(Post) {}
Agregat => object(Agregat) {}
Etablissement => object(Etablissement) {}
Departement => object(Departement) {}
Region => object(AppModel) {}
Ville => object(Ville) {}
[protected] _responseClass => 'CakeResponse'
[protected] _mergeParent => 'AppController'
[protected] _eventManager => object(CakeEventManager) {}
}
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array([maximum depth reached])
url => 'annuaire/1-ecoles/ville:breze'
base => ''
webroot => '/'
here => '/annuaire/1-ecoles/ville:breze'
[protected] _detectors => array(
[maximum depth reached]
)
[protected] _input => ''
}
- APP/webroot/index.php line 112 → Dispatcher->dispatch(CakeRequest, CakeResponse)
$Dispatcher->dispatch(
new CakeRequest(),
new CakeResponse()
);
object(CakeRequest) {
params => array(
[maximum depth reached]
)
data => array([maximum depth reached])
query => array([maximum depth reached])
url => 'annuaire/1-ecoles/ville:breze'
base => ''
webroot => '/'
here => '/annuaire/1-ecoles/ville:breze'
[protected] _detectors => array(
[maximum depth reached]
)
[protected] _input => ''
}
object(CakeResponse) {
[protected] _statusCodes => array(
[maximum depth reached]
)
[protected] _mimeTypes => array(
[maximum depth reached]
)
[protected] _protocol => 'HTTP/1.1'
[protected] _status => (int) 200
[protected] _contentType => 'text/html'
[protected] _headers => array([maximum depth reached])
[protected] _body => null
[protected] _file => null
[protected] _fileRange => null
[protected] _charset => 'UTF-8'
[protected] _cacheDirectives => array([maximum depth reached])
[protected] _cookies => array(
[maximum depth reached]
)
}