[freetds] Empty string VS Space in select

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Sep 21 07:50:35 EDT 2004


> 
> I'm on PHP 4.3.8 + FreeTDS 0.61 (protocol 7.0) + MSSQL 2000
> 

Try to enable log and if you can update FreeTDS.

> I already wrote about problem when inserting empty String in 
> my database.
> 
> I fact the true problem is during the select command (in my 
> database the
> value is really empty).
> If the value of a column is empty, then returned result is ' '
> 
> Any Idea ?
> 
> $sql = "select UTI_NOM from UTILISATEUR ID_UTILISATEUR=10";

where is where ???
Try also "select UTI_NOM, LENGHT(UTI_NOM) as LEN from UTILISATEUR WHERE ID_UTILISATEUR=10" there was a problem inserting data or using TDS 4.2... perhaps you used 4.2 to insert data... how did you compile php to enable mssql support ?

> $rs = mssql_query($sql);
> $row = @mssql_fetch_array($rs);
> echo $row["UTI_NOM"]; //write ' '
> 

here try

echo "name=-{$row["UTI_NOM"]}- len={$row["LEN"]}";

> 
> 
> NB : please to note that I must use @ because if I have not 
> result $rs is a
> true boolean instead of a ressource identifier
> 
> 
> Cédric
> 

French it's really a useful language... I'm going to take some lessons next month :)

freddy77



More information about the FreeTDS mailing list