PHP / jQuery / MySQL Live Search Help

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.

<script>
$(document).ready(function(){
  $(".func").hover(function(){
  $("#material").load("<?echo $display_url ?>");
    $(".stat").remove();
 });
});
</script>
<?
echo "<div id='material'></div>";
?>
.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.