Ok I have this little bit of code.

<?php
$con = mysql_connect("localhost","dbusername","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("dbname", $con);

$result = mysql_query("SELECT * FROM tb_comments");

while($row = mysql_fetch_array($result))
  {
  echo $row['sku'] . " " . $row['name'];
  echo "<br />";
  }

mysql_close($con);
?>

What I am trying to do with it is to make it pull a row from my database and when it returns it it is a link. The row is an sku number that I can add to the end of url and it will be a valid link.

As you can see above I attempted to do this by adding

echo "<a href=\"$row\">$row</a>";

but it did not work.

Any help would be appreciated. Thank you.

what's "not working"? nothings showing up? link doesnt click? etc

The above works fine but If I add

echo "<a href=\"$row\">$row</a>";

all it returns is the word "array" not anything from the database

The above works fine but If I add

echo "<a href=\"$row\">$row</a>";

all it returns is the word "array" not anything from the database

depends on which value you want, but if you change to this, you'll get the picture

echo "<a href=\"".$row[0]."\">".$row."</a>";

that will specify the first element of the array.

ok that seems to be doing the trick but when I add

/index.php?sku=

I get "" quotation marks around the displayed info in the link but on the part printed on the screen so it looks like this

/index.php?sku="dog"

How do I get rid of the quotation marks?

can you post the updated code? could be several things depending

<?php
$con = mysql_connect("localhost","hiddenfr_earthon","Stans2005*1019");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("hiddenfr_reviews", $con);

$result = mysql_query("SELECT * FROM tb_comments");

while($row = mysql_fetch_array($result))
  {
  echo "<a href=index.php?sku=\"".$row[sku]."\">".$row[sku]."</a>";
  echo "<br />";
  }

mysql_close($con);
?>

By the way thank you for taking the time to help me.

<?php
$con = mysql_connect("localhost","hiddenfr_earthon","Stans2005*1019");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("hiddenfr_reviews", $con);

$result = mysql_query("SELECT * FROM tb_comments");

while($row = mysql_fetch_array($result))
  {
  echo "<a href=\"index.php?sku=".$row[sku]."\">".$row[sku]."</a>";
  echo "<br />";
  }

mysql_close($con);
?>

Just needed to move the escaped quote to fix that.

No problem :)

commented: Very helpful and patient +1

You are my hero :) I wouldn't have gotten that any time soon.

One last thing and a thumbs up. Do you see any other issues or insecurities with that bit of code?

All its going to be used for is to display the links from the database.

nope. gone over it a few times. I don't see anything as long as the database is good.

Then we are all good. Thank you for your help and time. :)