Echo not working

I am working on a displaying a list of links in my admin system that I have entered into the Database. Each link is realted to a category that is in a separate table. I have written out an SQL statement that joins the 2 tables together however the variable information isn’t writting out onto my page?

Can anyone see my error I’m determined to learn how to hand code PHP and stay away from Dreamweavers toolkit.

thanks for any help…

<table>
<tr >
<th>Item Description</th>
<th>Category</th>
<th>Edit</th>
<th>Delete </th>
</tr>
<?php
include ('connections/config.php');
include ('connections/dbconn.php');

$query  = "SELECT tbl_links.link_id, tbl_links.link_title, tbl_links.link_desc, tbl_links.category_id, tbl_links.link_display, categories.category_name FROM tbl_links INNER JOIN categories ON tbl_links.category_ID = categories.category_name ORDER BY link_title";
$result = mysql_query($query) or die("error querying database");

$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>
<tr <?php if($i%2 == 1){ echo "class='tablerow2'"; }else{echo "class='tablerow1'";}?>>
<td>
<?php echo $result_ar['link_title']; ?></td>
<td>
<?php echo $result_ar['category_name']; ?>
</td>
<td class="button">
<a href="edit_link_detail.php?ID=<?php echo $result_ar['link_id']; ?>" title="Edit This Link">Edit</a>
</td>
<td class="button">
<a href="delete_link.php?ID=<?php echo $result_ar['link_id']; ?>" title="Delete This Link">Delete</a>
</td>
</tr>
<?php
$i+=1;

                    
}?>
</table>