Edit report at http://bugs.php.net/bug.php?id=53278&edit=1
ID: 53278 Updated by: [email protected] Reported by: consatan at gmail dot com Summary: mysql_result() can't return '' -Status: Closed +Status: Bogus Type: Bug Package: Apache2 related Operating System: win 2003 PHP Version: Irrelevant Block user comment: N New Comment: user error -> bogus Previous Comments: ------------------------------------------------------------------------ [2010-11-09 15:05:45] consatan at gmail dot com I am sorry!! I found that I am wrong, I'm not supposed to add extra "or die(mysql_error())" behind "mysql_result()". thx google translate! ------------------------------------------------------------------------ [2010-11-09 15:04:14] consatan at gmail dot com I am sorry!! I found that I am wrong, I'm not supposed to add extra "or die(mysql_error())" behind "mysql_result()". thx google translate ------------------------------------------------------------------------ [2010-11-09 14:36:24] consatan at gmail dot com I'm sorry! The test db data is CREATE TABLE `user` ( `id` int(4) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `desc` tinytext DEFAULT NULL, PRIMARY KEY(`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; INSERT INTO `user` VALUES ('u1', NULL), ('u2', ''); ------------------------------------------------------------------------ [2010-11-09 14:33:18] consatan at gmail dot com Description: ------------ --- >From manual page: http://www.php.net/function.mysql-result --- Test script: --------------- <?php // my php version:5.3.1 $conn = mysql_connect("127.0.0.1", "root", "root") or die(mysql_error()); mysql_select_db("mydb", $conn) or die(mysql_error()); $query = mysql_query("SELECT `desc` FROM `user` WHERE `id`=2", $conn) or die(mysql_error()); $desc = mysql_result($query, 0, 0) or die(mysql_error()); echo "no output<br />"; echo $desc; ?> Expected result: ---------------- I think it must return a string '', may be $desc = ''; The fllowing is test database. CREATE TABLE `user` ( `id` int(4) NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `desc` tinytext DEFAULT NULL, PRIMARY KEY(`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; INSERT INTO `user` VALUES ('u1', ''), ('u2', NULL); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53278&edit=1
