-3

Good morning, I have watched many times the code below and I could not understand where is the error. previously the error was on line 38 and was able to correct it, but now I just can not. Please help me.

thanks in advance

<?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';}
?>
  • You're using `quotation marks` or "" in the wrong way. When echoing text you have to escape evertyhing that's inside that might be confliting with the quotation marks used to delimitate your text. – Cristofor Oct 21 '16 at 09:54

1 Answers1

2

You're using quotation marks or "" in the wrong way.

When echoing text you have to escape evertyhing that's inside that might be confliting with the quotation marks used to delimitate your text, in that case:

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

would become

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