Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Can not get field_data from $query #1101

Closed
jsding opened this Issue Mar 2, 2012 · 3 comments

Comments

Projects
None yet
2 participants

jsding commented Mar 2, 2012

$query->field_data() cause following error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$Key

Filename: mysql/mysql_result.php

Line Number: 99

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$Type

Filename: mysql/mysql_result.php

Line Number: 92

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$Field

Filename: mysql/mysql_result.php

Line Number: 95

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$Default

Filename: mysql/mysql_result.php

Line Number: 97

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$Key

Filename: mysql/mysql_result.php

Line Number: 99

@narfbg narfbg closed this Mar 2, 2012

jsding commented Mar 3, 2012

Old code breakdown with the new fix.

Output:

array(6) { [0]=> object(stdClass)#16 (5) { ["name"]=> string(5) "Field" ["type"]=> string(6) "string" ["max_length"]=> int(192) ["primary_key"]=> int(0) ["default"]=> string(0) "" } [1]=> object(stdClass)#18 (5) { ["name"]=> string(4) "Type" ["type"]=> string(4) "blob" ["max_length"]=> int(589815) ["primary_key"]=> int(0) ["default"]=> string(0) "" } [2]=> object(stdClass)#19 (5) { ["name"]=> string(4) "Null" ["type"]=> string(6) "string" ["max_length"]=> int(9) ["primary_key"]=> int(0) ["default"]=> string(0) "" } [3]=> object(stdClass)#20 (5) { ["name"]=> string(3) "Key" ["type"]=> string(6) "string" ["max_length"]=> int(9) ["primary_key"]=> int(0) ["default"]=> string(0) "" } [4]=> object(stdClass)#21 (5) { ["name"]=> string(7) "Default" ["type"]=> string(4) "blob" ["max_length"]=> int(589815) ["primary_key"]=> int(0) ["default"]=> string(0) "" } [5]=> object(stdClass)#22 (5) { ["name"]=> string(5) "Extra" ["type"]=> string(6) "string" ["max_length"]=> int(81) ["primary_key"]=> int(0) ["default"]=> string(0) "" } }

$db->field_data("mytable") -> name is always "Field", not the column name.

Can not get Field name from the resultset.

Contributor

narfbg commented Mar 3, 2012

Meh ... that method's design should probably be changed.
3722e50

jsding commented Mar 3, 2012

Yes, this commit fixed the problem. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment