Jump to content

Output issues


thefollower

Recommended Posts

i have a field which contains this exact string:

 

<a href="cafe.php">Cafe <?=$CityName?></a>

 

But on output on the php page all it shows it:

 

Cafe

 

For some reason it won't show the <?=$CityName?>. The variable is set as i do not get a undefined variable error. So is it something to do with mysql stopping php tags coming out with its string?

 

This is the script, as you see i have put no special function to be prevent the <?=$ to be loading up so i do not know why it isn't loading it:

 

<?php
$SELECT = mysql_query("SELECT Link FROM citypages WHERE Area='$CityArea' AND (CityID='$CityID' OR CityID='0')")
	Or die(mysql_error());
While($row = mysql_Fetch_assoc($SELECT)){
?>
     <?=$row['Link']?><br>
<?php
   }
?>

Link to comment
https://forums.phpfreaks.com/topic/115034-output-issues/
Share on other sites

"undefined variable" means the variable hasn't been set it doesn't exist

ie

<?php
echo $test; //<--undefined variable
$test = "tester"; //Set variable
echo $test; //<--working variable
?>

 

the problem doesn't seam to be with the SQL, but with the page that has

<a href="cafe.php">Cafe <?=$CityName?></a>

 

personally i don't use short tags

try

<?php

echo $row['Link'];

?>

Link to comment
https://forums.phpfreaks.com/topic/115034-output-issues/#findComment-591554
Share on other sites

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.