menwn Posted January 29, 2009 Share Posted January 29, 2009 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 Link to comment https://forums.phpfreaks.com/topic/143013-php-and-select-return-name-of-month-instead-of-number/ Share on other sites More sharing options...
DarkWater Posted January 29, 2009 Share Posted January 29, 2009 How is it stored in your database? What's the field's type and what does it say if you actually go and look directly in the database? P.S: Greek! Link to comment https://forums.phpfreaks.com/topic/143013-php-and-select-return-name-of-month-instead-of-number/#findComment-749919 Share on other sites More sharing options...
menwn Posted January 30, 2009 Author Share Posted January 30, 2009 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: Link to comment https://forums.phpfreaks.com/topic/143013-php-and-select-return-name-of-month-instead-of-number/#findComment-750467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.