#35245 [NEW]: mysql_query not working when ob-Start() is called before

From: Date: Wed, 16 Nov 2005 18:23:30 +0000
Subject: #35245 [NEW]: mysql_query not working when ob-Start() is called before
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88300@lists.php.net to get a copy of this message
From: walkekev at gmail dot com Operating system: Linux PHP version: 4.4.1 PHP Bug Type: MySQL related Bug description: mysql_query not working when ob-Start() is called before Description: ------------ The script will not do my sql statement if the ob_start() is called before my sql statement Reproduce code: --------------- <?php // first page of code $name = basename($_FILES['userfile']['name']); $filename = $_FILES['userfile']['tmp_name']; $data = file_get_contents($filename); $filedata = mysql_real_escape_string($data); list($width, $height) = getimagesize($filename); $sql = "INSERT INTO pictures ( id , name , height , width , type , data ) VALUES ( '', '$name', '$height', '$width', 'a', '$filedata')"; mysql_query($sql); require('./code/obufthumb.php'); require('./database/sql.php'); $sql = "INSERT INTO pictures ( id , name , height , width , type , data ) VALUES ( '', '$name', '$newheight', '$newwidth', 'b', '$filedata')"; mysql_query($sql); ?> <?php // this is obufthumb.php if($height > $width){ $newheight = '120'; $newwidth = '120' / $height * $width; } else{ $newwidth = '120'; $newheight = '120' / $width * $height; } $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($filename); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); ob_start(); imagejpeg($thumb, NULL, 100); $filedata = ob_get_contents(); ob_end_clean(); ?> Expected result: ---------------- is should insert 2 images into the database, one that is no more then 120px wide or tall. Actual result: -------------- it only inserts one into the database, the first one, with type a. when i remove the ob_start() and ob_end_clean() it will work, both wil be inserted, but all the code of the jpeg is inserted into my screen -- Edit bug report at http://bugs.php.net/?id=35245&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35245&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35245&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35245&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=35245&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35245&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35245&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35245&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35245&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35245&r=support Expected behavior: http://bugs.php.net/fix.php?id=35245&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35245&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35245&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35245&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35245&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35245&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35245&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35245&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35245&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35245&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35245&r=mysqlcfg

« previous php.bugs (#88300) next »