|
-
February 23rd, 2009, 11:25 AM
#1
Catchable fatal error: Object of class DateTime could not be converted
Hi...
i'm testing php + mssql 2005 compatibility, using some DLLs microsoft relased which are php_sqlsrv.dll and php_sqlsrv_ts.dll
i couldn't establish a connection with the first one, so i tried with the second one and it worked, i could run some queries perfectly until i got this error:
Catchable fatal error: Object of class DateTime could not be converted to string in C:\Archivos de programa\Apache Group\Apache2\htdocs\asea\conectamssql.php on line 16
i found out that when it reads a datetime or smalldatetime field it shows me that error, why? how could i make it work?
thanks in advance...
Here is the code:
PHP Code:
<?php $serverName = ("myServer"); $uid = ("userDB"); $pwd = ("myPWD"); $connectionInfo = array("UID" => $uid, "PWD" => $pwd,"Database"=>"someDB"); $conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) { $result = sqlsrv_query($conn,"select * from sometable"); if ($result) { while($row = sqlsrv_fetch_array($result)) { for ($i=0; $i < sqlsrv_num_fields($result); $i++) /*THIS IS LINE 16*/ echo $row[$i]; } } } else { echo "Connection could not be established.\n"; die( print_r( sqlsrv_errors(), true)); } sqlsrv_close( $conn); ?>
Last edited by PeejAvery; February 23rd, 2009 at 11:52 AM.
Reason: Adde PHP tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|