Jump to content

php and select return name of month instead of number


menwn

Recommended Posts

Hello everyone,

 

I cannot solve an issue for some time now. I have an sql server 2005 and through Apache I use php 5.2 and I execute this query:

 

SELECT * from TABLE where couponid = COUPONID

 

When I execute the select in Sql server the date field is returned correctly but in php i get the following response

 

arrOptions = new Array(["2","456789","ΚΩΣΤΑΣ","Κώστα","ΣΩΤΗΡΑΚΟΠΟΥΛΟΣ","6/mars/1986 0:00"]);

 

The month is in French instead of 6/03/1986 that it is in the sql server and is what I need!!!

 

my code producing this is

$query = "SELECT * from $tableupdate where couponid = $txtcouponid ";

$result= mssql_query($query);
if (!$result)
{
die("There was an error in executing the ajaxQuery </br> ");
}
unset($strJSArr);
$strJSArr ="arrOptions = new Array(";
$iCount = 0;
while($row = mssql_fetch_array($result)) 
    {	
    	$strJSArr .="[";
       while ($iCount<$nums)
       {
         if ($iCount>0)
       {
       		$strJSArr .=",";
       }
       $strJSArr .="\"". $row[$iCount]."\"";
       
       $iCount++;
       }
        $strJSArr .="]";
       
    }
$strJSArr.=");";


echo $strJSArr;

 

This prepares $strJSArr for Javascript (the above code is part of the server side script). The problem is in php though and not Javascript as I have confirmed that php echoes the response I wrote above.

 

Php is running on windows xp professional using xampp.

 

Thanks in advance for any help

menwn

The field is a datetime field in the database and the values are strored like that: 30/11/1985 12:00:00 πμ.

 

The collation of the server is Greek_AS. It seems as php is recognising that the field is datetime (which it is) and gives the month's name. (but why in French?!).

 

P.S:  ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.