php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30644 same strlen of mssql filed value
Submitted: 2004-11-01 08:10 UTC Modified: 2004-11-01 08:19 UTC
From: chenxi at shine dot com dot cn Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.0.2 OS: LINUX RedHat9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 - 18 = ?
Subscribe to this entry?

 
 [2004-11-01 08:10 UTC] chenxi at shine dot com dot cn
Description:
------------
Select data from mssql, and get length of the filed value by using function strlen(), but i got the same output '40', following is field info and smaple code.



Reproduce code:
---------------
name utName (char) 40

$dbh = @mssql_connect($tnserver_ipaddr, $tnserver_user, $tnserver_passwd);
if ($dbh) {
	$room_num = GetRoomNum();
	mssql_select_db("this");
	$sql = "SELECT * FROM [dbo].[HotelFolioView] WHERE (RoomNo = '$room_num')";
	$ret = mssql_query($sql);	

	while ($row = mysql_fetch_array($ret)) {
		print strlen($row['name']).'\r\n';
	}

	mssql_free_result($ret);
}

Expected result:
----------------
4
7
12
8
....
different length

Actual result:
--------------
40
40
40
40
....
all same '40', this is length of filed 'name'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-01 08:19 UTC] derick@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

.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu May 26 11:05:45 2022 UTC