Bug #53278 [Opn]: mysql_result() can't return ''
| From: | consatan at gmail dot com | Date: | Tue, 09 Nov 2010 14:04:15 +0000 |
| Subject: | Bug #53278 [Opn]: mysql_result() can't return '' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-155881@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53278&edit=1
ID: 53278
User updated by: consatan at gmail dot com
Reported by: consatan at gmail dot com
Summary: mysql_result() can't return ''
Status: Open
Type: Bug
Package: Apache2 related
Operating System: win 2003
PHP Version: Irrelevant
Block user comment: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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