#33331 [Opn->Bgs]: PHP doesn't like the MySQL RIGHT() command
| From: | georg@php.net | Date: | Tue, 14 Jun 2005 06:57:29 +0000 |
| Subject: | #33331 [Opn->Bgs]: PHP doesn't like the MySQL RIGHT() command | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80288@lists.php.net to get a copy of this message | ||
ID: 33331
Updated by: georg@php.net
Reported By: internet at cratemedia dot com
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: Linux web2 2.4.27
PHP Version: 4.3.10
New Comment:
Sorry, but 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 as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-06-14 05:25:01] internet at cratemedia dot com
The RIGHT() command works on columns that are of the
type 'text' but not on biging(20).
------------------------------------------------------------------------
[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