![]() |
|
#1
|
|||
|
|||
Klickable web-urls from database.Im trying to make my weburls/emails klickable but i cant figure out how to. Would love to have some help, see my .php-file here;
<?php $conn = mysql_connect("localhost", "root", "xxx"); mysql_select_db("receptionen",$conn); $sql = "select * from emosms"; $result = mysql_query($sql, $conn) or die(mysql_error()); while ($newArray = mysql_fetch_array($result)) { $namn = $newArray['namn']; $mobil = $newArray['mobil']; echo "$namn $mobil<br>"; } ?> Where and exactly how do i put my <a href....? Many thanks. |
|||
|
#2
|
|||
|
|||
|
suppose $namn as url:
echo "<a href=\"$namn\" title=\"$namn URL\">$mobil</a>"; |
|
#3
|
||||
|
||||
|
Hello giobbi,
Paste a sample of the data you are going to have to work with. If you have URLs or Emails included in a block of text, then we will definitely need some simple functions with regex done. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
|||
|
|||
|
Thanks for the fast reply. Yes, that was the answer i was looking for. Im currently using a filed with a email or weburl so anything there have to be klickable. I tried it and it works for the klick but it seems to refer to my local web-folder and not the actual link like http://www.macosxhints.com becomes http://localhost/web/www.macosxhints.com? Same with emails? Is there another tag for emails?
JDS asked my next question, how to make weburls and email clickable in an large chunk of text automaticly, how do i do that? |
|
#5
|
||||
|
||||
|
By the way, I have been meaning to write some code to do exactly this (parse some string or text and convert URLs into links)...
I'll see if I can come up with something today or tomorrow. Once I am ready, I will post it here. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#6
|
|||
|
|||
|
when you specify a link it must be of this type: http://www.some.com
and not like: http://www.some.com For emails: <a href="mailto:somemail@some.com">email</a> |
|
#7
|
|||
|
|||
|
Thx JdS, nice of you.
Well, better way (?) is to put http:// i the a href=..tag before the $xxxx to make it a link i think. Don't bother the user with mumbo-jumbo stuff.. : ) |
|
#8
|
||||
|
||||
|
Sorry giobbi, when I let myself get into fixing the USER/MEMBER groups "promotions and demotions" stuff (for the forum) over the weekend, I completely forgot about this thread and my promise.
I had started work on something... give me a few minutes or so and I will post something up. A little caution though: the code has not been tested extensively and it may not work with some URLs because I don't think I have thought of everything.. yet. You might have to let me know if you find anything wrong with it, ok? __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#9
|
||||
|
||||
|
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#10
|
|||
|
|||
|
Many thanks JdS! Really nice code!
|
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Parsing PHP code that's stored in a database. | JdS | MySQL / PHP Forum | 3 | 13-May-2004 09:15 |
| Redirect multiple URLs to one script, masking true URL | Maccaday | Apache Web Server Forum | 1 | 10-Dec-2003 08:34 |
| WInXp Apache database? | Ticoloco | Apache Web Server Forum | 1 | 27-Nov-2003 04:21 |
| [Tutorial] MySQL Basics | nniehoff | MySQL / PHP Forum | 15 | 23-Mar-2003 19:42 |
| Generating simple URLs for search engines | jrobbio | MySQL / PHP Forum | 1 | 17-Mar-2003 11:22 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The