Neden
ile benim comment

1 Cevap php

Ne zamandan beri:

//echo "[$sql][$result][$rows][$e]<BR>";

cause an error? The code following this comment gets spwewed out as source in the browser! Bear in mind I use php daily, I've never seen this before! I'm porting an ancient php app from an old Win2k box to a new Windoze 2003 server - apache 2.2, mysql 5.1.32, php 5.2.9, and the app is bombing all over the place cos there's commented out code everywhere. Any switches to stop it being so sensitive to comments? I know // followed by ?> then code will break as ?> terminates the php, but BR tags ? Surely not.

Daha fazla bilgi: kod yığınıdır

if ($condition){
  // do stuff
} else {
  $sql="select * from person where percode='$person'";
  $result=mysql_db_query($db,$sql,$conn);
  @$rows=mysql_num_rows($result);
  $e=mysql_errno()." ".mysql_error();
  //echo "[$sql][$result][$rows][$e]<br>";
  $perfname=mysql_result($result,0,"perfname");
  $persname=mysql_result($result,0,"persname");
  $peraddr1=mysql_result($result,0,"peraddr1");
}
?>

Yorumlarınız için kod kadar iyi çalışır. Yorumun sonra yukarı kodu?> Tarayıcı içine dışarı kustu edilir. Bundan sonra, HTML görüntü gayet iyi. Yorum çıkarın (hatta sadece BR etrafında kod çalışması gayet iyi yapar.

1 Cevap

You could have the short open tag setting turned off in the php.ini file of the new server you are moving to. If this setting is turned off, all of your <? tags are ignored and only code between the full

<?php ve ?> etiketleri PHP kodu olarak ayrıştırılır. Bu ayar kapalı olup olmadığını görmek ve düzeltmeleri bunun üstünde çevirerek eğer.

Eğer değilse yanlışlıkla yorumlarla önce '?> her yerde yapıyoruz olmadığını kontrol edin. Ayrıca, tam kod bloğunu paylaşımı yardımcı olacaktır.