par
Larker » 12 juin 2016, 18:45
Bonjour,
Je viens de modifier ma version de php et depuis j'ai un certain nombres de fonctionnalités qui ne fonctionnent plus. Entre autre la recherche en autocompletion sur mon site.
Je n'ai aucun message d'erreur mais elle a cessé de fonctionner. Donc je voulais savoir comment activer les erreurs ajax pour voir où se situe le problème ?
Voici le code :
<?php
define(PROTECTION_FICHIER, 'protection_Projet');
include('inc/config.php');
function searchForKeyword($keyword) {
global $bdd;
$stmt = $bdd->prepare("SELECT * FROM `fiche_film` WHERE titre LIKE ? ORDER BY titre limit 6");
$keyword = '%'. $keyword . '%';
$stmt->bindParam(1, $keyword, PDO::PARAM_STR, 100);
$isQueryOk = $stmt->execute();
$results = array();
if ($isQueryOk) {
$results = $stmt->fetchAll();
} else {
trigger_error('Error executing statement.', E_USER_ERROR);
}
//
$serieslimit=6-count($results);
$stmt2 = $bdd->prepare("SELECT * FROM `fiche_serie` WHERE titre LIKE ? ORDER BY titre limit $serieslimit");
$keyword = '%'. $keyword . '%';
$stmt2->bindParam(1, $keyword, PDO::PARAM_STR, 100);
$isQueryOk = $stmt2->execute();
$results2 = array();
if ($isQueryOk) {
$results2 = $stmt2->fetchAll();
} else {
trigger_error('Error executing statement.', E_USER_ERROR);
}
$bdd = null;
$results_fin = array_merge($results, $results2);
return $results_fin;
}
$keyword = $_GET['keyword'];
$data = searchForKeyword($keyword);
echo json_encode($data);
?>
Merci d'avance.
Bonjour,
Je viens de modifier ma version de php et depuis j'ai un certain nombres de fonctionnalités qui ne fonctionnent plus. Entre autre la recherche en autocompletion sur mon site.
Je n'ai aucun message d'erreur mais elle a cessé de fonctionner. Donc je voulais savoir comment activer les erreurs ajax pour voir où se situe le problème ?
Voici le code :
[php]<?php
define(PROTECTION_FICHIER, 'protection_Projet');
include('inc/config.php');
function searchForKeyword($keyword) {
global $bdd;
$stmt = $bdd->prepare("SELECT * FROM `fiche_film` WHERE titre LIKE ? ORDER BY titre limit 6");
$keyword = '%'. $keyword . '%';
$stmt->bindParam(1, $keyword, PDO::PARAM_STR, 100);
$isQueryOk = $stmt->execute();
$results = array();
if ($isQueryOk) {
$results = $stmt->fetchAll();
} else {
trigger_error('Error executing statement.', E_USER_ERROR);
}
//
$serieslimit=6-count($results);
$stmt2 = $bdd->prepare("SELECT * FROM `fiche_serie` WHERE titre LIKE ? ORDER BY titre limit $serieslimit");
$keyword = '%'. $keyword . '%';
$stmt2->bindParam(1, $keyword, PDO::PARAM_STR, 100);
$isQueryOk = $stmt2->execute();
$results2 = array();
if ($isQueryOk) {
$results2 = $stmt2->fetchAll();
} else {
trigger_error('Error executing statement.', E_USER_ERROR);
}
$bdd = null;
$results_fin = array_merge($results, $results2);
return $results_fin;
}
$keyword = $_GET['keyword'];
$data = searchForKeyword($keyword);
echo json_encode($data);
?>[/php]
Merci d'avance.