MYSQL select statement with a WHERE clause with the purpose of linking to another page

CODE

<?php
//set variables to connect to the database
$hostName = "(FILL IN HOSTNAME FOR DB)";
$userName = "(FILL IN USERNAME FOR DB)";
$password = "(FILL IN PASSWORD FOR DB)";
$dbName = "(FILL IN DB NAME)";
// make connection to database 
mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName");
mysql_select_db($dbName) or die("Unable to select database $dbName");
?>
<!--Using a select statement with a "WHERE" clause-->
<!--start a table with the column headers in the top row-->
<table>
  <tr>
	<td>Header</td>
  </tr>
<?php
//break the table with php to set up the query and resulting rows after the column headers
// Select all the fields in all the records of the table WHERE a condtion is met (set by the "WHERE" clause
$query_display_restriction = "SELECT * from (FILL IN TABLE NAME) WHERE (FILL IN FIELD NAME) = '(FILL IN RESTRICTION VARIABLE)'";//the restriction is typically a variable set earlier on the page. An example "WHERE" clause may be: "WHERE record_id='$rid'"
$result_display_restriction = mysql_query($query_display_restriction) /*or die(mysql_error())*/;//include the die statement to alert any errors in the query (remove /* and */ to uncomment)
$number_display_restriction = mysql_num_rows($result_display_restriction);
//set the counting variable for a while loop equal to zero
$i_display_restriction= 0;
//set up a while loop to run until the number of rows from the display query is reached
while($i_display_restriction < $number_display_restriction)
{
//Create variable names for each piece of information to be displayed. Declare the result statement to use to get the necessary information. Set the variables to the correct rows of the query by using the while loop couting variable. Finish defining the variable by setting the field name from the database table
	$record_id = mysql_reusult($result_display_restriction,$i_display_restriction, "record_id");
	$variable1 = mysql_result($result_display_restriction,$i_display_restriction, "field1");

?>
<!--the next row of the table represents the number or rows resulting from the query.  Each cell will display a different piece of information from the set variables-->
  <tr>
	<td><a href="display.php?id="<?php echo $id; ?>><?php echo $variable1; ?></a></td>
  </tr>
<?php
//incriment the couning variable and end the while loop
	$i_display_restriction++;
}
?>
</table>
DISPLAY
This is the basic layout of the above code
Header
row 1 text
row 2 text
row 3 text
row 4 text
row 5 text
row 6 text
row 7 text
row 8 text
row 9 text
row 10 text