viraj wrote:
i have this query..
$sql = "SELECT `id` FROM `modules_permissions` WHERE `id` = '" .
$permissionId . "';";
when i pass the value 31 to permissionid, it returns me the 31st row
of the table. and it's fine. but when i pass '31asasa' as the
permissionid it returns me the same row! how come this possible?
`id` is a integer and the storage engine is myisam. i'm on debian and
mysql version is 5.0.51a-15
~viraj
completely normal behavior; any trailing non numeric chars are stripped
leaving only the numerics
mysql> select CAST('12aaa' as SIGNED);
+-------------------------+
| CAST('12aaa' as SIGNED) |
+-------------------------+
| 12 |
+-------------------------+
1 row in set, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+--------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: '12aaa' |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php