Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to create a link out of document "Titles"?

1:44 am on Oct 11, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 21, 2004
votes: 0

Hi Dreamcatcher,

Thanks for the great advice. I have another question. How would I turn the titles of my database news articles into links. I would like for the visitor to click the title, and be taken to the actual page the article is located? Can that be done?

Thanks in Advance,

(insert.php script)
// connect to the mysql server
mysql_connect("localhost","moot","ok") or die (mysql_error());
echo "Connected to Mysql<br/>";

// select the database
mysql_select_db("News_Articles") or die
echo "Connected to Database<br/>";

// insert data into ccds_news table
$sql = "INSERT INTO ccds_news(article_title, author_name, subject, date_created, content, EMAIL) VALUES('" . $_POST['article_title'] . "', '" . $_POST['author_name'] . "', '" . $_POST['subject'] . "', '" . $_POST['date_created'] . "', '" . $_POST['content'] . "', '" . $_POST['EMAIL'] . "' )";

// run the query


6:27 am on Oct 11, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:June 5, 2003
votes: 0

Hi Senmar,

I'm not quite sure what you're trying to do (it's early in the morning so i'm not quite with it). Perhaps you could tell us what pages these articles are displayed on, or is that what you are asking about?


7:48 am on Oct 11, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 19, 2003
votes: 0

Obviously, you'll need echo and some knowledge of variables or arrays. Then, look at the 'parameters' your script is making in the urls - ht*p://mysite.com/index.php?this=whatever&that=whatever - parameters here being 'this' and 'that' - these produce elements of the array $_GET on the page that the link goes to - you'll want to figure out how to 'echo' out links that look like this with the proper parameters. If you don't have a link structure like this, you'll have to figure out what your link structure is, and produce url's according to that.

The php.net tutorial has a page on forms at [be2.php.net...] and you might want to get a book on paper too.

Happy coding!

8:54 am on Oct 11, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 30, 2003
votes: 0

Like mincklerstraat mentions, you`ll need to look into arrays and query strings. When you pull your data, you`ll need to loop through the entries and assign the article ID to a query string, ie: www.yoursite.com/articles.php?id=ID. Use mysql_fetch_array() to loop the entries.

When any link is clicked, you simply pull data based on the value of 'id' in the query string.

if (isset($_GET['id']))
$query = "SELECT FROM table WHERE id = '" . $_GET['id'] . "' LIMIT 1";
//rest of code

I would suggest you follow the link that mincklerstraat has posted, it should point you in the right direction.

9:27 am on Oct 11, 2004 (gmt 0)

Senior Member from ES 

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:July 24, 2002
votes: 2

hi senmar,

are you talking about links like this:


for a story with the title: "freddie star ate my hamster"?

you need to google for 'search engine friendly URLs'. this article by sitepoint is a great starter: [sitepoint.com...] (although it might not work unless you have register_globals on in your php setting.) have a read and come back with questions.

good luck


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members