Page 1 of 1

[SOLVED]Automatic Link Creation

Posted: Wed Jun 02, 2004 4:34 am
by Gyromind
I want to have a database of URLs associated with text strings, and whenever one of those strings is typed, I would like it to automatically convert to a link. Is this at all possible?

Posted: Wed Jun 02, 2004 4:36 am
by patrikG
[php_man]link[/php_man]

Posted: Wed Jun 02, 2004 4:41 am
by Gyromind
Sorry, I guess it's that I'm just kinda new to PHP, but this doesn't help at all. I know what link does. But how would I get this to associate with a database of predifined urls, and more importantly, how would I get it to dynamically update those text strings into links every time that I post to my page?

PS - I'm not asking anyone to write a script for me. But maybe point me to a similar script that I can learn from. Or throw some ideas at me.

Posted: Wed Jun 02, 2004 4:52 am
by patrikG
You will need to
a) query the database (I suggest a while-loop), probably with sorted with MySQL's "ORDER BY"
b) in that loop have your string-to-URL converting code
c) output it

There's a tutorial on database access etc at http://hotwired.lycos.com/webmonkey/99/21/index3a.html ,
PHP's [php_man]MySQL[/php_man] functions and some worthwhile sample-chapters to download at http://www.sitepoint.com/books/phpmysql1/

Posted: Wed Jun 02, 2004 4:55 am
by Gyromind
Thanks.

Posted: Wed Jun 02, 2004 4:58 am
by patrikG
:)