|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-01-21 12:57 UTC] arion_ at msn dot com
Description:
------------
If a field is empty it returns one blank space character.
Reproduce code:
---------------
<?php
$host="XXX";
$usuario="User";
$password="Password";
$bbdd="BBDD";
$conexion=mssql_connect("$host","$usuario","$password");
$qry="SELECT Field
FROM dbo.Table";
$handle=mssql_query($qry);
$registro=mssql_fetch_row($handle);
$Nothing=$registro[0];
echo "Just" .$Nothing. "DoIt";
?>
Expected result:
----------------
JustDoIt
Actual result:
--------------
Just DoIt
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 07:00:01 2025 UTC |
I think this is a bug anyway. CodeSample 1: <?php $db=mssql_connect('myserver','sa','sa'); mssql_select_db('mydb',$db); //$sql = "DROP TABLE dbtest"; //$res=mssql_query($sql,$db); $sql = "CREATE TABLE dbtest (id int NOT NULL,abc varchar(20),PRIMARY KEY (id))"; $res=mssql_query($sql,$db); $sql = "INSERT INTO dbtest (id,abc) VALUES (1,'')"; $res=mssql_query($sql,$db); $sql = "SELECT abc as xy from dbtest WHERE id=1"; $res=mssql_query($sql,$db); $d = mssql_fetch_object($res); mssql_close($db); echo 'o'.$d->xy.'o'; ?> Expected Output: oo Actual Output: o o CodeSample 2: <?php $db=mssql_connect('myserver','sa','sa'); mssql_select_db('mydb',$db); //$sql = "DROP TABLE dbtest"; //$res=mssql_query($sql,$db); $sql = "CREATE TABLE dbtest (id int NOT NULL,abc varchar(20),PRIMARY KEY (id))"; $res=mssql_query($sql,$db); $sql = "INSERT INTO dbtest (id,abc) VALUES (1,'')"; $res=mssql_query($sql,$db); $sql = "SELECT 'x'+abc as xy from dbtest WHERE id=1"; $res=mssql_query($sql,$db); $d = mssql_fetch_object($res); mssql_close($db); echo 'o'.$d->xy.'o'; ?> Expected Output: oxo Actual Output: oxo I find the following example interesting: CodeSample 3: <?php $db=mssql_connect('myserver','sa','sa'); mssql_select_db('mydb',$db); //$sql = "DROP TABLE dbtest"; //$res=mssql_query($sql,$db); $sql = "CREATE TABLE dbtest (id int NOT NULL,abc varchar(20),PRIMARY KEY (id))"; $res=mssql_query($sql,$db); $sql = "INSERT INTO dbtest (id,abc) VALUES (1,'')"; $res=mssql_query($sql,$db); $sql = "SELECT len(abc) as abclen,abc as xy from dbtest WHERE id=1"; $res=mssql_query($sql,$db); $d = mssql_fetch_object($res); mssql_close($db); echo $d->abclen; ?> Expected Output: 0 Actual Output: 0 I have tested with php 4.3.6, 4.3.7-dev and 5.0.0RC3-dev on Windows Server 2003 with MSSQL 2000. Well, is this a bug or a bogus? I think this is a bug! Greetings Marco