#34497 [Opn->Fbk]: problem returning data field

From: Date: Wed, 14 Sep 2005 06:13:52 +0000
Subject: #34497 [Opn->Fbk]: problem returning data field
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85008@lists.php.net to get a copy of this message
ID: 34497 Updated by: sniper@php.net Reported By: diong at comcast dot net -Status: Open +Status: Feedback Bug Type: MSSQL related Operating System: windows 2000 PHP Version: 4.4.0 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. Previous Comments: ------------------------------------------------------------------------ [2005-09-14 05:36:28] diong at comcast dot net Description: ------------ when returning a char type data type from ms sql the field has an added space at the end of it. This was not a problem in 4.3 and I just had to copy the php_mssql.dll from the old version to 4.4 and it corrected the problem. Reproduce code: --------------- I am calling a class to get the field: $SVars = new SessionVars(); $userid = $SVars->GetVar("username"); $query = "SELECT * FROM tSecUser WHERE (SecUser='" . $userid . "')"; $resultsec = $sqlw->sqlquery($query,$cn); $linesec = $sqlw->fetch_array($resultsec); echo "<P>*".$linesec["SecUser"]."*"; The echo statement displays *dgering * it should display *dgering* here is the class for SessionVars <? //Define the SessionVars class class SessionVars { var $seshid; var $varname; var $varvalue; Function SaveVar($VarName,$VarValue) { $sqlw = new sqlwrapper(); $cn = $sqlw->dbcn(); Function GetVar($VarName) { // connect to database $sqlw = new sqlwrapper(); $cn = $sqlw->dbcn(); // Retrieves Session Variable from SessVars Table $sqlquery = "SELECT VarValue FROM SessVars WHERE (SessionID = '" . $this->seshid . "') AND (VarName = '" . $VarName . "')"; $res = $sqlw->sqlquery($sqlquery, $cn); $row = $sqlw->fetch_row($res); return $row[0]; } } ?> Expected result: ---------------- The echo statement displays *dgering * Actual result: -------------- it should display *dgering* ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34497&edit=1

« previous php.bugs (#85008) next »