解析错误:语法错误,意外T_ECHO,期待','或';'在第40行的/web/htdocs/www.bp-electronics.com/home/bpgest2/sheets/ddt.php中

时间:2016-10-21 09:49:54

标签: php

早上好, 我已经多次看过下面的代码,我无法理解错误在哪里。以前错误是在第38行,并能够纠正它,但现在我不能。 请帮帮我。

提前致谢

<?php
     if(!$getQ[1]){
       if(@$_GET['undo']){mysql_query("UPDATE ddt SET ddtundo=1 WHERE  id='".$_GET['undo']."'");}
?>
<br><br>
<table border="0" cellspacing="1" cellpadding="4" width="99%" align="center">

 <tr>
   <td align="center" width="22"></td>
   <td align="left" class="txt_lit_grey" width="180"><b>Data</b></td>
   <td align="left" class="txt_lit_grey"><b>Cliente</b></td>
   <td align="left" class="txt_lit_grey"><b>Decoder</b></td>
   <td align="left" class="txt_lit_grey" width="90"><b>N. articoli</b></td>
   <td align="center" width="22"></td>
   <td align="center" width="22"></td>
   <td align="center" width="22"></td>
   <td align="center" width="22"></td>
 </tr>

 <?php
     $row=0;
     $qu=mysql_query("SELECT * FROM users");
     while($ru=mysql_fetch_assoc($qu)){$users[$ru['id']]=$ru['fullname'];}

     $q=mysql_query("SELECT * FROM ddt ORDER BY data DESC");
     while($r=mysql_fetch_assoc($q)){
          $tot=count(explode("|",$r['ware']));
          $items=explode("|",$r['ware']); 
          for($i=0;$i<count($items);$i++){
             if($i%2){$fill=1;}else{$fill=0;}
             $value=explode("#",$items[$i]); 
             $qc=mysql_query("SELECT * FROM catalog WHERE id='".$value[0]."'");
             $rc=mysql_fetch_assoc($qc); 
           }
           if($row%2){$bgcolor="#ffffff";}else{$bgcolor="#eeeeee";}

           echo "<tr>n";
           if($r['ddtundo']){echo "<td bgcolor="#dddddd" height="5" align="center" class="txt_lit_white radius"> </td>n";}else{echo "<td bgcolor="#dddddd" height="5" align="center" class="txt_lit_white radius"> </td>n";}

           echo "<td bgcolor="$bgcolor" height="5" align="left" class="txt_lit_black">".date("d/m/Y H:i.s",strtotime($r['data']))."</td>n";
           echo "<td bgcolor="$bgcolor" height="5" align="left" class="txt_lit_black">".$r['operator']."</td>n";
           echo "<td bgcolor="$bgcolor" height="5" align="left" class="txt_lit_black">".$rc['short_description']."</td>n";
           echo "<td bgcolor="$bgcolor" height="5" align="left" class="txt_lit_black">".$tot."</td>n";

           echo "<td bgcolor="$bgcolor" align="center"><a class="cb_iframe" href="sheets/ddt/pdf_ddt.php?id=".$r['id']."" title="Visualizza"><img src="img/icons/view.png"></a></td>n";
           echo "<td bgcolor="$bgcolor" align="center"><a class="cb_iframe" href="sheets/ddt/modify.php?id=".$r['id']."" title="Modifica"><img src="img/icons/modify.png"></a></td>n"; 
           echo "<td bgcolor="$bgcolor" align="center"><a class="cb_iframe" href="sheets/ddt/delete.php?id=".$r['id']."" title="Elimina"><img src="img/icons/download.png"></a></td>n"; 

           echo "</tr>n";
           $row++;
      }    
 ?>
</table>
<table border="0" cellspacing="4" cellpadding="4" width="99%">
     <tr>
        <td valign="top" align="right">
           <a href"sheets/ddt/new_ddt.php"><input type="button" class="button_blu button_big" value="<?php if($_SESSION['DDT']['DATA']){echo "Apri DDT in sospeso";}else{echo "Nuovo DDT";}?>">
           </a>
        </td>
     </tr>
</table>
<?php

    }else{@include 'sheets/ddt/new_ddt.php';}
?>

1 个答案:

答案 0 :(得分:2)

您正在使用quotation marks或&#34;&#34;以错误的方式。

当回显文本时,你必须逃避内部的内容,这可能会与用于分隔文本的引号相混淆,在这种情况下:

echo "<td bgcolor="$bgcolor" height="5" align="left" class="txt_lit_black">".date("d/m/Y H:i.s",strtotime($r['data']))."</td>n";

会变成

echo "<td bgcolor=\"$bgcolor\" height=\"5\" align=\"left\" class=\"txt_lit_black\">".date("d/m/Y H:i.s",strtotime($r['data']))."</td>n";