Jump to content

[SOLVED] losing variables between php brackets


delphi123

Recommended Posts

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?

$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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.