954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How To Create A Link From A DB Record?

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() . "\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.

mobo57
Newbie Poster
5 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

Change that last line to:

echo '<a href="'.$sample12.'">'.$sample12.'</a>

See if that works.

EvolutionFallen
Junior Poster
198 posts since Aug 2009
Reputation Points: 40
Solved Threads: 31
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You