From: internet at cratemedia dot com Operating system: Linux web2 2.4.27 PHP version: 4.3.10 PHP Bug Type: MySQL related Bug description: PHP doesn't like the MySQL RIGHT() command
Description: ------------ PHP will not successfully execute the RIGHT() command in a mysql_query(). It executes successfully, affects 1 row, but doesn't actually substring the field from the right. The same query works, directly in MySQL, but not through the mysql_query() offered in PHP. Example: UPDATE sales SET ccnum=RIGHT(ccnum,4) WHERE ID=3301 LIMIT 1 Reproduce code: --------------- $sql="UPDATE sales SET ccnum=RIGHT(ccnum,4) WHERE ID=$ID LIMIT 1"; $results = mysql_query($sql); Expected result: ---------------- It should shorten the ccnum field to 4 characters starting at the right. Others have suggested just using the SUBSTRING() mysql command, but that doesn't work from the right, which is what I need. Actual result: -------------- Executes without error, but doesn't shorten the string. -- Edit bug report at http://bugs.php.net/?id=33331&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33331&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33331&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33331&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33331&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33331&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33331&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33331&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33331&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33331&r=support Expected behavior: http://bugs.php.net/fix.php?id=33331&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33331&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33331&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33331&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33331&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33331&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33331&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33331&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33331&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33331&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33331&r=mysqlcfg
