I'm a novice with PHP and I have a script I'm trying to use that doesn't parse correctly. I've attached the PHP file here. The problem is with the non-escaping of the > and sometimes " The resulting page is displayed below: "; } $ListingTable .= "\n\t"; $ListingTable .= "$a1[city], $a1[state], $a1[address] $sub\n\t"; $ListingTable .= "$a1[rooms] br, $a1[bathrooms] ba"; $MyPrice = number_format($a1[Price], 2, ".", ","); $ListingTable .= "\n\t$$MyPrice\n"; $ListingTable .= "\n"; } $ListingTable .= ""; } /////////////////////////////////////////////////////////// ///////////// top 10 /////////////////////////////////////////////////////////// $q1 = "select * from re2_listings, re2_agents, re2_priority where re2_listings.AgentID = re2_agents.AgentID and re2_agents.PriorityLevel = re2_priority.PriorityLevel and re2_agents.AccountStatus = 'active' order by visits desc limit 0,9 "; $r1 = mysql_query($q1) or die(mysql_error()); $lrows = mysql_num_rows($r1); if($lrows > '0') { $TopTable .= "\n"; while($a1 = mysql_fetch_array($r1)) { $TopTable .= " \n\t"; if($a1[PriorityLevel] > '1') { $sub = "$a1[PriorityName]"; } else { $sub = ""; } $TopTable .= "\n\t "; if(!empty($a1[image])) { $TopTable .= ""; } $TopTable .= " \n\t"; $TopTable .= " $a1[city], $a1[state], $a1[address] $sub \n\t"; $TopTable .= " $a1[rooms] br, $a1[bathrooms] ba"; $MyPrice = number_format($a1[Price], 2, ".", ","); $TopTable .= " \n\t $$MyPrice \n"; $TopTable .= " \n"; } $TopTable .= " "; } require_once("templates/IndexTemplate.php"); echo " "; require_once("templates/FooterTemplate.php"); ?> Code (markup): How do I correct this part of the code? In this instance, I reversed the equation so that i could use <, but in some cases in the script, doing that will not work. Any suggestions?
I've tried changing the > symbols to \> to no avail. From what I'm reading, that should work. However, I must be doing something wrong, because I can't get that to work. Is it possible that PHP is not set up correctly on my server?
I figured out most of the problems were with the php files beginning with <? instead of <?php. There were a few other problems, but i'm getting most of them worked out. Thanks for your response sadcox66, its greatly appreciated.
I find it extremnely annoying when programmers assume php files will work with <? I have yet to have a Linux of Windows install of PHP where that short form works. Coders need to work harder at sticking to standards and use methods which will work, instead of those which "should". I still see it in people's php code. Functions which and methods which are due to be deprecated continue to used, despitre compatibility and/or security issues.