Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Add Link to Echo Result

php database query



7:51 pm on Oct 8, 2013 (gmt 0)

Example 1 below works:
echo "<p><h2>".$results['title']."</h2>".$results['shortdesc']."</p>";

I need to make the title linkable to the page url. I'm probably putting the ' and " in the wrong places for the link part.

Example 2 I've added the url code but does not work:
echo "<p><h2><a href=http://www.example.com/".$results['url'].".$results['title']."</a>"</h2>".$results['shortdesc']."</p>";

Any help would be appreciated. Thx.


9:46 pm on Oct 8, 2013 (gmt 0)

A got a response from another forum so I'll just add that below since it worked.

echo '<h2><a href="http://www.example.com/' . $results['url'] . '">' . $results['title'] . '</a></h2><p>' . $results['shortdesc'] . '</p>';

Featured Threads

Hot Threads This Week

Hot Threads This Month