Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

list results with links..

$
0
0

hey guys i have this ajax autos suggest  form and it works but all the suggestions have the same link..

 

 

 
// Query
$q = @$_GET['q'];
$ql = strlen($q);
 
// Target mode
$target = @$_GET['target'];
 
// Limitation of suggestions
$limit = "15";
 
$results = array();
$sql = "SELECT *
FROM $Fiscale
WHERE LEFT(Nom, $ql)='$q'
ORDER BY `Nom`
LIMIT $limit";
$res = mysql_query($sql) or die (mysql_error());
while ($row = mysql_fetch_assoc ($res)) {
$results[] =  $row["Nom"]."-".$row["Prenom"];
$E_ID =  $row["N_Fiche"];
}
 
if(!empty($results)) {
echo "<ul>";
for($i=0;$i<count($results);$i++){
$url = @str_ireplace("%s", urlencode($results[$i]), $_GET['E_ID']);
 
echo "<li><a href='V.php?N_F=".$E_ID."' target='".$target."'>".str_ireplace($q, $q."<b>", $results[$i])."</b></br></a></li>";
}
echo "</ul>";
} }

Viewing all articles
Browse latest Browse all 13200

Trending Articles