voici la page qui contient le script;
<?php
session_start();
// on vérifie toujours qu'il s'agit d'un membre qui est connecté
if (!isset($_SESSION['login'])) {
// si ce n'est pas le cas, on le redirige vers l'accueil
header ('Location: index.php');
exit();
}
?>
<?php require_once('Connections/localhost.php'); ?><?php mysql_select_db( $database_localhost ); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Créer un nouveau dossier</title>
<style>
.conteneur{
padding:10px;
background:#eeeeee;
border:1px solid #bbbbbb;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
width:90%;
margin:auto;
}
a:link {
font-size:15px; text-decoration:none
}
a:visited {
font-size:15px; text-decoration:none; color:#000000
}
a:active {
font-size:15px; text-decoration:none
}
a:hover {
font-size:15px; text-decoration:underline
}
form{
margin:15px;
padding:5px;
border-bottom:1px solid #ddd;
}
form input[type=submit]{display:none;}
div#results{
padding:10px 0px 0px 15px;
}
div#results div.result{
padding:10px 0px;
margin:10px 0px 10px;
}
div#results div.result a.readMore{color:green;}
div#results div.result h2{
font-size:19px;
margin:0px 0px 5px;
padding:0px;
color:#1111CC;
font-weight:normal;
}
div#results div.result h2 a{
text-decoration:none;
border-bottom:1px solid #1111cc;
}
div#results div.result p{
margin:0;
padding:0;
}
span.highlight{
background:#FCFFA3;
padding:3px;
font-weight:bold;
}
</style>
<script type="text/javascript">
var runningRequest = false;
var request;
//Identify the typing action
$('input#q').keyup(function(e){
e.preventDefault();
var $q = $(this);
if($q.val() == ''){
$('div#results').html('');
return false;
}
//Abort opened requests to speed it up
if(runningRequest){
request.abort();
}
runningRequest=true;
request = $.getJSON('rechercheclient.php',{
q:$q.val()
},function(data){
showResults(data,$q.val());
runningRequest=false;
});
//Create HTML structure for the results and insert it on the result div
function showResults(data, highlight){
var resultHtml = '';
$.each(data, function(i,item){
resultHtml+='<div class="result">';
resultHtml+='<h2><a href="#">'+item.title+'</a></h2>';
resultHtml+='<p>'+item.post.replace(highlight, '<span class="highlight">'+highlight+'</span>')+'</p>';
resultHtml+='<a href="#" class="readMore">Read more..</a>'
resultHtml+='</div>';
});
$('div#results').html(resultHtml);
}
$('form').submit(function(e){
e.preventDefault();
});
});
</script>
</head>
<body>
<div id="conteneur" class="conteneur">
<table width="100%">
<tr>
<td width="20%" valign="top">
<?php if(isset($_GET['etape']) AND $_GET['etape']=="1"){
?><font color="#FF0000"><a href="nouveaudossier.php?etape=1" style="color:#FF0000" >ETAPE 1/6:<br /> Le créancier</a></font>
<?php } ?>
</td>
<td width="80%" valign="top">
<?php if(isset($_GET['etape']) AND $_GET['etape']=="1"){
?>
<div id="creancier"><form method="get" action="rechercheclient.php">
<fieldset><legend>
Le créancier</legend>
<label for="q"></label>
<input type="text" id="q" name="q" />
<input type="submit" value="Search" />
</fieldset></form>
</div>
<div id=”results”></div>
<?php } ?>
</td>
</tr>
</table>
</div>
</body>
</html>
et voici la page qui se nomme rechercheclient.php
<?php
session_start();
// on vérifie toujours qu'il s'agit d'un membre qui est connecté
if (!isset($_SESSION['login'])) {
// si ce n'est pas le cas, on le redirige vers l'accueil
header ('Location: index.php');
exit();
}
?>
<?php require_once('Connections/localhost.php'); ?><?php mysql_select_db( $database_localhost ); ?>
<html>
<head>
</head>
<body>
<?php
if(!empty($_GET['q'])) {
search();
}
function search() {
$con = mysql_connect('localhost','root', '');
mysql_select_db('users', $con);
$q = mysql_real_escape_string($_GET['q'], $con);
$sql = mysql_query("
SELECT
* as post
FROM client p
WHERE code_client LIKE '%{$q}%' OR nom_commercial LIKE '%{$q}%'
");
//Create an array with the results
$results=array();
while($v = mysql_fetch_object($sql)){
$results[] = array(
'title'=>$v->title,
'post'=>$v->post
);
}
//using JSON to encode the array
echo json_encode($results);
}
?>
</body>
</html>
ce qui se passe, c'est que justement rien ne se passe, normalement il est censé afficher les résultats au fur et à mesure que je tape la requête mais la je n'ai rien, ni message d'erreur. Je ne sais pas comment procéder, par avance merci pour votre aide.