kevloink Posted August 10, 2006 Share Posted August 10, 2006 Can you use variables in sql statments, or links? Like 'a href=$varhere' Or SELECT #varhere FROM table. Quote Link to comment Share on other sites More sharing options...
Woodburn2006 Posted August 10, 2006 Share Posted August 10, 2006 indeed you can, just make sure you put: a href="<? echo $variable; ?>" if the link is not in a php statement already Quote Link to comment Share on other sites More sharing options...
obsidian Posted August 10, 2006 Share Posted August 10, 2006 [quote author=kevloink link=topic=103743.msg413355#msg413355 date=1155231491]Can you use variables in sql statments, or links? Like 'a href=$varhere' Or SELECT #varhere FROM table.[/quote]as long as you echo the variable in such a way that it will be translated, yes indeed.for instance:[code]<?php// these will work:echo "<a href=\"$myLink\">Some Link Text</a>";$sql = mysql_query("SELECT $myColumn FROM tableName");// this will not:echo '<a href="$myLink">Some Link Text</a>';?>[/code] Quote Link to comment Share on other sites More sharing options...
kevloink Posted August 10, 2006 Author Share Posted August 10, 2006 Cool, thanks very much! ;D ;D ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.