delphi123 Posted October 31, 2009 Share Posted October 31, 2009 Hi folks, have got this code: $id=mysql_result($result,0,"itemid"); $title=mysql_result($result,0,"title"); $thumbnail=mysql_result($result,0,"data_txt"); $publish_up=mysql_result($result,0,"publish_up"); $hits=mysql_result($result,0,"hits"); echo $title; ?> <h2> <a href="#"> <?php $title; ?> </a> </h2> This is a simplified version, but the second use of $title doesn't work at all, just returns blank, whereas the first does? Is there some rule about variables being lost across <?php ?> tags or something? Quote Link to comment https://forums.phpfreaks.com/topic/179732-solved-losing-variables-between-php-brackets/ Share on other sites More sharing options...
RichardRotterdam Posted October 31, 2009 Share Posted October 31, 2009 use echo just $title won't do anything <?php echo $title; ?> Quote Link to comment https://forums.phpfreaks.com/topic/179732-solved-losing-variables-between-php-brackets/#findComment-948298 Share on other sites More sharing options...
Jnerocorp Posted October 31, 2009 Share Posted October 31, 2009 $id=mysql_result($result,0,"itemid"); $title=mysql_result($result,0,"title"); $thumbnail=mysql_result($result,0,"data_txt"); $publish_up=mysql_result($result,0,"publish_up"); $hits=mysql_result($result,0,"hits"); echo $title; ?> <h2> <a href="#"> <?php echo $title; ?> </a> </h2> Quote Link to comment https://forums.phpfreaks.com/topic/179732-solved-losing-variables-between-php-brackets/#findComment-948299 Share on other sites More sharing options...
delphi123 Posted October 31, 2009 Author Share Posted October 31, 2009 <doh!> Sorry - asp slipping back in! Thanks very much! Quote Link to comment https://forums.phpfreaks.com/topic/179732-solved-losing-variables-between-php-brackets/#findComment-948304 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.