php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19253 random garbage in echo or print output
Submitted: 2002-09-05 11:16 UTC Modified: 2002-09-05 15:28 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rdavis2 at gmu dot edu Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.2.2 OS: Windows XP Pro
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rdavis2 at gmu dot edu
New email:
PHP Version: OS:

 

 [2002-09-05 11:16 UTC] rdavis2 at gmu dot edu
I am running PHP 4.2.2, Apache 2.0.3.9, and MySQL 4.0.1-alpha-nt

I am using the following code to insert rows in to a html table:

######START CODE######
  db_connect();

  $result = mysql_query("SELECT * FROM db ORDER BY title");
  if ($result) {
    for($movies=0; $sts_tmp = mysql_fetch_row($result); ++$movies) {

      if($movies % 2 == 0) { $bgcolor="#CCCCCC"; }else{ $bgcolor="#DDDDDD"; }

      echo "      <TR>\n";
      for($x=0;$x<6;++$x)
        print "        <TD BGCOLOR='$bgcolor'>$sts_tmp[$x]</TD>\n";

      echo "        <TD BGCOLOR='$bgcolor'><INPUT TYPE='BUTTON' VALUE='Delete' ONCLICK=\"JavaScript:document.location='movie.php?action=delete&title=$sts_tmp[0]'\"></TD>\n" .
           "      </TR>\n\n";
    }

    echo "<TR><TD COLSPAN='7'><B>Total Movies: " . mysql_num_rows($result) . "</B></TD></TR>\n";
    mysql_free_result($result);
  }

  db_close();

######END CODE######

Most of the time the script runs fine, but every other third time or so extra garbage code appears in with the normal output.

Garbage Code:

      <TR>
        <TD BGCOLOR='#DDDDDD'>Mallrats</TD>
        <TD BGCOLOR='#DDDDDD'>0</TD>
        <TD BGCOLOR='#DDDDDD'>0</TD>
        <TD BGCOLOR='#DDDDDD'>0</TD>
??S???S?    BGCO @o?'#DDDDDD'>CD</TD>
        <TD BGCOLOR='#DDDDDD'></TD>
        <TD BGCOLOR='#DDDDDD'><INPUT TYPE='BUTTON' VALUE='Delete' ONCLICK='JavaScript:document.location="movie.php?action=delete&title=Mallrats"'></TD>
      </TR>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-05 15:28 UTC] georg@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 13 13:01:27 2025 UTC