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? 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; ?> 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> 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! 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
Archived
This topic is now archived and is closed to further replies.