ID:               33331
 User updated by:  internet at cratemedia dot com
 Reported By:      internet at cratemedia dot com
 Status:           Open
 Bug Type:         MySQL related
 Operating System: Linux web2 2.4.27
 PHP Version:      4.3.10
 New Comment:

The RIGHT() command works on columns that are of the 
type 'text' but not on biging(20).


Previous Comments:
------------------------------------------------------------------------

[2005-06-14 04:40:38] internet at cratemedia dot com

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 this bug report at http://bugs.php.net/?id=33331&edit=1

Reply via email to