I've been working on this one for the last two days and seem to be hitting the wall.
How things work is the user uploads his files to a directory on my server with the names of the files and a new page name being inserted into a mysql table.

Then the code generates a new page with the new page name. This new page gets the content, the files uploaded by the user, from the file names in the database. Some of the files are images that I want to create links to on the new page which will open in a new tab in the browser.

My problem is every example of this I have tried does not work. Everything works up to generating the workable links. Here is the section of code that is not working:

$query12 = ("SELECT rsworks5 FROM scuserspro WHERE rsusername = '$reguser'")or die(mysql_error());
$result12 = mysql_query($query12);
if($result12 == false)
{
   user_error("Query failed: " . mysql_error() . "<br />\n$query");
}
elseif(mysql_num_rows($result12) == 0)
{
   echo "<p>Sorry, no samples are available.</p>\n";
}
else
{
   while($query_row = mysql_fetch_array($result12))
   {
      foreach($query_row as $key => $string)
      {
      }
   }
} 
      $sample12 = $string;

echo "$rsworks5";
echo "<a href="$sample12="['rsworks5'] . "\">" . $row['rswork5'] . "</a>";

I appreciate your input and help on this.
Thanks.