Im going to hit myself for sure once I figure this out but I have been having trouble trying to return a URL from a database and displaying a link using that info. Heres what I have ?><div><? echo $row['url']; ?></div><? PHP: Now of I want it to be a link with the anchor text the same url value. Can someone help me please! Would be something like this I am guessing, but this dont work. ?><div><? echo "<a href'.$row['url'].'>.$row['url'].</a>; ?></div><? PHP:
Something like: ?><div><? echo "<a href='" . $row['url'] . "'>" . $row['url'] . "</a>"; ?></div><? you mean?
Let's also teach some best practices. (Hint: Look at the quotes. ) echo '<a href="'. $row['url'] .'">'. $row['url'] .'</a>'; PHP:
I agree that 'best practices' are good to be taught (I thought about requoting that string) but then figured: a) sometimes it's better to make the least changes possible (easier to diff); and b) (no offence to you, aaron_nimocks, but) the guy had PHP / HTML code that included not setting an HREF correctly (no equal sign), a single, unclosed string and concatenations inside of that string. Sometimes it's best to just do what you have to do.