ID:               49856
 Updated by:       u...@php.net
 Reported By:      joao at jjmf dot com
 Status:           Open
 Bug Type:         PDO related
 Operating System: CentOS 5.3
 PHP Version:      5.3.0
 New Comment:

Sorry, can't reproduce. Works fine for me with PHP 5.3.2-dev if either
using libmysql or mysqlnd.

array(6) {
  ["Field"]=>
  string(2) "id"
  ["Type"]=>
  string(7) "int(11)"
  ["Null"]=>
  string(2) "NO"
  ["Key"]=>
  string(3) "PRI"
  ["Default"]=>
  string(1) "0"
  ["Extra"]=>
  string(0) ""
}
array(1) {
  ["_version"]=>
  string(19) "5.0.77-community-nt"
}


Maybe others can reproduce, if you provide the table structure. Does
SHOW COLUMNS work properly on the mysql prompt? 


Previous Comments:
------------------------------------------------------------------------

[2009-11-04 18:43:43] u...@php.net

Sorry, can't reproduce. Works fine for me with PHP 5.3.2-dev if either
using libmysql or mysqlnd.

array(6) {
  ["Field"]=>
  string(2) "id"
  ["Type"]=>
  string(7) "int(11)"
  ["Null"]=>
  string(2) "NO"
  ["Key"]=>
  string(3) "PRI"
  ["Default"]=>
  string(1) "0"
  ["Extra"]=>
  string(0) ""
}
array(1) {
  ["_version"]=>
  string(19) "5.0.77-community-nt"
}


Maybe others can reproduce, if you provide the table structure. Does
SHOW COLUMNS work properly on the mysql prompt? 

------------------------------------------------------------------------

[2009-11-04 17:22:21] joao at jjmf dot com

Mysql version is 5.0.77-3.el5

------------------------------------------------------------------------

[2009-11-04 17:09:06] u...@php.net

What MySQL version are you using?

------------------------------------------------------------------------

[2009-10-13 02:23:02] joao at jjmf dot com

Description:
------------
When executing the query "SHOW COLUMNS FROM table" it returns weird 
results.
Database: MySQL.
I think it's something related to CentOS 5.3 since I got this problem 
after migrating from Ubuntu. This never happened in Ubuntu. 

Reproduce code:
---------------
---
>From manual page: pdostatement.fetch#Descrição
---
$pdo = new PDO(
    'mysql:host=localhost;dbname=MYDB', 'MYUSER', 'MYPASS',
    array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")
);


$sql = "SHOW COLUMNS FROM tablename";
$sth = $pdo->prepare($sql);
$sth->execute();

/* Exercise PDOStatement::fetch styles */
print("PDO::FETCH_ASSOC: ");
print("Return next row as an array indexed by column name\n");
$result = $sth->fetch(PDO::FETCH_ASSOC);
print_r($result);
print("\n");


Expected result:
----------------
For each column an array like:
[Field] => 'id_user'
[Type] => 'int(11) unsigned'
[Null] => 'NO'
[Key] => 'PRI'
[Default] => null
[Extra] => 'auto_increment'

Actual result:
--------------
For each column an array like:
[Field] => id_user
[COLUMN_TYPE] => int(11) unsigned 
[COLUMNS] => NO 
[] => 
[def] => auto_increment 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49856&edit=1

Reply via email to