php - Turning url from SQL into clickable link -



php - Turning url from SQL into clickable link -

i'm trying create text url inserted 'tag' column of sql database turned clickable link within php table. right now, i'm having manually set link html in database, don't want do.

this code i've got:

<?php mysql_connect(localhost, user, pw) or die(mysql_error()); mysql_select_db(database) or die(mysql_error()); ?> <table id=table class=display> <thead><tr><th>owner</th><th>soquili's name</th><th>sex</th><th>generation</th><th>parents</th><th>kind</th><th>theme</th><th>colorist</th><th>tag</th><th>alt 1</th><th>alt 2</th><th>alt 3</th></tr></thead> <tbody> <?php // result limit $sql = "select * soquili limit 25"; $result = mysql_query($sql)or die(mysql_error()); while($row = mysql_fetch_array($result)){ //reference $name = $row['owner']; $soq = $row['soq']; $sex = $row['sex']; $gen = $row['gen']; $parents = $row['parents']; $kind = $row['kind']; $theme = $row['theme']; $colorist = $row['colorist']; $tag = $row['tag']; $alt1 = $row['alt1']; $alt2 = $row['alt2']; $alt3 = $row['alt3']; // looped row echo "<tr><td>".$name."</td> <td>".$soq."</td><td>".$sex."</td> <td>".$gen."</td> <td>".$parents."</td> <td>".$kind."</td> <td>".$theme."</td> <td>".$colorist."</td> <td><a href=\".$tag.\">tag</a></td> <td>".$alt1."</td> <td>".$alt2."</td> <td>".$alt3."</td> </tr>"; } ?> </tbody></table>

i can't see why it's not working.

this website: http://rpwith.us/test2/

and have test entry (search weeese) text url won't turn clickable. suggestions?

the quotes on line a tag wrong.

correct:

<td><a href=\"".$tag."\">tag</a></td>

explanation:

the \" serves insert literal quote, want have quote end string literal, . $tag . parsed php code.

the way did it, ". $tag ." part part of string literal; however, you're using double quotes, $tag replaced automatically php, but dots remain. result: have pair of dots in output.

php sql hyperlink clickable

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -