php - showing images in autocomplete results -
i stored image urls in column b of database , hope show them in picture form in autocomplete results. tried compose code follows, gives urls in text format. can solve it? many thanks.
index.php
<script type="text/javascript"> $(document).ready(function(){ $("input[name='search']").autocomplete({ source:'search.php', minlength:1 }); }); </script> <input type="text" name="search" required/>
search.php
$keyterms = $_get['term']; $query = $database->query("select * table '%".$keyterms."%' order asc"); while ($row = $query->fetch_assoc()) { $data[] = $row['b'];} echo json_encode($data);
something :
$keyterms = $_get['term']; $query = $database->query("select * table '%".$keyterms."%' order asc"); while ($row = $query->fetch_assoc()) { $data[] = '<a href="' . $row['b'] . '"></a>';} echo json_encode($data);
note: not final solution, hint solution.
Comments
Post a Comment