Syntax for displaying query results as hyperlink.
Posted 15 July 2006 - 01:35 PM
$con = mysql_connect("host","user","pass");
die('Could not connect: ' . mysql_error());
$result = mysql_query("SELECT * FROM theTable");
while($row = mysql_fetch_array($result))
//$site = $row['siteName'];
//$url = $row['siteURL'];
//echo "<a href='$url'>$site[/url]";
echo $row['siteName'] . " " . $row['siteURL'];
echo "<br />";
As is, the script returns, for example:
As you've already guessed, my problem is with the three lines that are currently commented out.
What is the proper syntax for the echo <a> tag?
Posted 15 July 2006 - 01:44 PM
$site = $row['siteName'];
$url = $row['siteURL'];
echo "<a href=\"$url\">$site</a>";
Posted 15 July 2006 - 02:11 PM
echo "<a href=\"$url\">$site[/url]";Returned a blank page. It looks like it should work, and now I'm curious why it doesn't.
Did I mis-type something?
echo "<a href='". $row['siteURL']. "'>". $row['siteName']. "</a><br />";Returned a list hyperlinks. Right on.
I should've posted this yesterday. All the countless hours wasted.
Posted 15 July 2006 - 02:27 PM
this message board some how, changed </a> to [/url]
I had to put the comment inside a code block. hmmm
Posted 15 July 2006 - 02:54 PM
I, too, now see the purpose of using the Insert Code feature, though.
Anyway, I tested your modified example, and it works. Thanks.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users