Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.