You can do this in a much easier way, your while loop just needs to look like:
//start looping through items
while $row = mysql_fetch_array$result
// add a row to the loop
$tmpl-addRow$row;
//end while
.. and now in your template, just change the TMPL_VAR name's to exactly what the column is called in the database:
a href=rgordon_detailspg.php?ID=tmpl_var name=ID escape=url&Suburb=tmpl_var name=Suburb escape=url
go there/a
You don't need to have a seperate variable, just because you're URL escaping the string... vlibTemplate will handle this on the fly, not changing the variable itself. :)
Tip:
When you're adding a result directly from a database, you can use the setDbLoop() function (check out the docs). So instead of the while loop in your code, you would put:
$tmpl-setDbLoop'loop1', $result, 'MYSQL';
That's a lot simpler.
Regards,
Kelvin