Integrating jQuery into a mysql array?

Integrating jQuery into a mysql array?

This is my first step so if this cant be done its okay just need some pointers

Here is the code:

function wall_home()
{
global $ir,$c,$userid,$h;
$wall=mysql_query("SELECT * FROM wall",$c) or die(mysql_error());
print "<table width=100% class=forumline>
<th colspan=4>The Wall</th><tr>
<td colspan=2 align=center><a href=thewall.php?action=post>Make A Post</a></td><tr>
<th width=30%>Poster</th><th width=70%>Post</th><th>Action</th><tr>";
while($wa=mysql_fetch_array($wall))
{
$user=mysql_query("SELECT * FROM users where userid={$wa['wallUSERID']}",$c) or die(mysql_error());
$wu=mysql_fetch_array($user);
$wazz=mysql_query("SELECT * FROM wallcomments WHERE wcWALL={$wa['wallID']}",$c) or die(mysql_error());
$num=mysql_num_rows($wazz);
print"<td><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}</a></td>
<td>{$wa['wallTEXT']}</td><tr><td></td><td>
<style>
  div { background:#def3ca; margin:3px; width:80px;
  display:none; float:left; text-align:center; }
  </style>
  <script src='jquery.js'></script>
 
  <button id='showr'>Show</button>
  <button id='hidr'>Hide</button>
<div>";$wac=mysql_query("SELECT * FROM wallcomments WHERE wcWALL={$wa['wallID']}",$c);
print "<table width=100% class=forumline>";
$user=mysql_query("SELECT * FROM users where userid={$wa['wallUSERID']}",$c);
$wu=mysql_fetch_array($user);
while($wc=mysql_fetch_array($wac))
{
$user=mysql_query("SELECT * FROM users where userid={$wc['wcUSERID']}",$c);
$wu=mysql_fetch_array($user);
print"<td><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}</a></td>
<td align=center>{$wc['wcTEXT']}</td><tr>";
}
print"</div>
<script>
$('#showr').click(function () {
  $('div:eq(0)').show('slow', function () {
    $(this).next('div').show('slow', arguments.callee);
  });
});
$('#hidr').click(function () {
  $('div').hide(3000);
});

</script>
</td>";
if($wa['wallUSERID'] == $userid || $ir['user_level'] != 1)
{
print"<td width=40%><a href=thewall.php?action=delete&post={$wa['wallID']}>Delete Post</a></td>";
}
print"</tr>

<td><hr></td><td><hr></td><td><hr></td></tr>";
}
print"</table>";
}

Say the table has 5 rows in it it will show 5 different rows on the html table and have a Show Hide on each of them so you can view the comments of them and hide it. My problem is only the first one works. The rest have no functionality.