#19253 [NEW]: random garbage in echo or print output

From: Date: Thu, 05 Sep 2002 16:16:11 +0000
Subject: #19253 [NEW]: random garbage in echo or print output
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18498@lists.php.net to get a copy of this message
From: rdavis2@gmu.edu Operating system: Windows XP Pro PHP version: 4.2.2 PHP Bug Type: MySQL related Bug description: random garbage in echo or print output 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> -- Edit bug report at http://bugs.php.net/?id=19253&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19253&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19253&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19253&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19253&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19253&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19253&r=support Expected behavior: http://bugs.php.net/fix.php?id=19253&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19253&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19253&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19253&r=globals

« previous php.bugs (#18498) next »