php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #23990 mssql_fetch_assoc does not support long column names
Submitted: 2003-06-03 11:29 UTC Modified: 2003-06-03 19:44 UTC
From: php at electricsurfer dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.2 OS: Win XP PRO
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at electricsurfer dot com
New email:
PHP Version: OS:

 

 [2003-06-03 11:29 UTC] php at electricsurfer dot com
If you select a field with a column name that has more than 30 chars. Using mssql_fetch_assoc or mssql_fetch_row to fetch it will only return a key with the 1st 30 chars.
( Mysql functions work with longer column names )

<?
// connect to db Here
$result = mssql_query('select MyVeryVeryVeryVeryVeryVeryLongColumnName from table');
$row = mssql_fetch_assoc($result);
// $row = array('MyVeryVeryVeryVeryVeryVeryLong'=>50) (only first 30 chars in key)
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-03 11:41 UTC] php at electricsurfer dot com
with mssql_fetch_assoc or mssql_fetch_array.

NOT mssql_fetch_row.
 [2003-06-03 12:16 UTC] php at electricsurfer dot com
mssql_field_name() has same problem
 [2003-06-03 16:42 UTC] php at electricsurfer dot com
Just found bug #20810 which coincides with this one.

mssql_fetch_field() also has the same problem.
 [2003-06-03 18:48 UTC] fmk@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Functions returning a column name are based on the dbcolname() function in DBLIB. DBLIB from microsoft was developed for SQL Server 6.x where the max identifier length was 30

#define SQL_MAX_COLUMN_NAME_LEN             30

This is only a problem on Win32 where we use DBLIB from Microsoft. On platforms where we use FreeTDS this is not a problem.
 [2003-06-03 19:44 UTC] philip@php.net
This is now documented and will show up when the manual is next built, thanks for the report :)

http://cvs.php.net/cvs.php/phpdoc/en/reference/mssql/reference.xml


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 15:01:27 2024 UTC