# PHP / jQuery / MySQL Live Search Help

**URL:** https://forum.kirupa.com/t/php-jquery-mysql-live-search-help/331696
**Category:** programming
**Created:** [September 28, 2013, 12:05pm UTC](https://forum.kirupa.com/t/php-jquery-mysql-live-search-help/331696 "2013-09-28T12:05:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![theflashdude](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@theflashdude](https://forum.kirupa.com/u/theflashdude)
#### Post date: [September 28, 2013, 12:05pm UTC](https://forum.kirupa.com/t/php-jquery-mysql-live-search-help/331696/1 "2013-09-28T12:05:39Z")

</div>

Hi Guys,

I’m working on a small project and require some urgent help. it’s really annoying me.

I’m doing a basic live search query using jquery and php/mysql.  
I have a variable called display\_url which is a mysql id field.  
Eg. $display\_url = check.php?id=$result[‘id’]

Everytime I do a jquery mouseover to show the result on a table, it shows the last id in the list.  
So when I search for chocolate (there are two chocolate results with a unique ID to them), they both display in the live search, however, only the last id result is shown in the \<div\> result (it’s supposed to update according to the result I highlight).

How do I code it so the div element updates each times a new ID is highlighted?  
In the address URL, the id field changes, but it’s not refreshing the \<div\> element.

Here’s a code snippet.

```auto
<script>
$(document).ready(function(){
  $(".func").hover(function(){
  $("#material").load("<?echo $display_url ?>");
    $(".stat").remove();
 });
});
</script>
<?
echo "<div id='material'></div>";
?>

```

```auto
.func // is from the hyperlink class (<a href="#" class=".func">)
#material // is the empty div element.
.stat // is a query which I remove once the live search query is highlighted.

```

Please help.
