dcparham Posted July 22, 2008 Share Posted July 22, 2008 [searched, did not see similar topic covered] - My code outputs where should be just a blank[reads in no middle name/field is blank], instead outputs "Object id #[some number here - single digit]" - something like[output fields replaced with anonyms]: Elvis G. Manson III Elton Object id #4 Pachino James Teaufast Dean note the "Object id #4"? the Code: <?php //connect to db/cshUsers.mdb database: $db_conn = new COM("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("databaseFolder/attorneys/companyDirectory1a.mdb").";"; $db_conn->open($connstr); if(!$db_conn) { print("OOPS!"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $rS = $db_conn->execute("SELECT * FROM Raleigh WHERE floor='3' ORDER by LastName"); $FirstName = $rS->Fields('FirstName'); $Middle= $rS->Fields('Middle'); $LastName = $rS->Fields('LastName'); while (!$rS->EOF) { $FullName = $FirstName." ".$Middle." ".$LastName; echo "<font style='font-size: 90%'>".$FullName."</font><br>"; $rS->MoveNext(); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $rS->Close(); $db_conn->Close(); /////////////////////////////////////////////////////// ?> incidentally, not doing the same from same database/table, when using classic ASP, but yet in PHP. Please help? Quote Link to comment https://forums.phpfreaks.com/topic/116098-php-and-mysql-reading-from-msaccess-db-outputs-object-id/ Share on other sites More sharing options...
trq Posted July 22, 2008 Share Posted July 22, 2008 <?php //connect to db/cshUsers.mdb database: $db_conn = new COM("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("databaseFolder/attorneys/companyDirectory1a.mdb").";"; $db_conn->open($connstr); if(!$db_conn) { print("OOPS!"); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $rS = $db_conn->execute("SELECT * FROM Raleigh WHERE floor='3' ORDER by LastName"); while (!$rS->EOF) { $FirstName = $rS->Fields('FirstName'); $Middle= $rS->Fields('Middle'); $LastName = $rS->Fields('LastName'); $FullName = $FirstName." ".$Middle." ".$LastName; echo "<font style='font-size: 90%'>".$FullName."</font>"; $rS->MoveNext(); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $rS->Close(); $db_conn->Close(); /////////////////////////////////////////////////////// ?> Quote Link to comment https://forums.phpfreaks.com/topic/116098-php-and-mysql-reading-from-msaccess-db-outputs-object-id/#findComment-596987 Share on other sites More sharing options...
dcparham Posted July 23, 2008 Author Share Posted July 23, 2008 now this is interesting - i actually get the same result whether the vars are outside the loop or inside; i almost was thanking you for the solution before even trying the code, but the result is the same. the blanks/spaces/NULL values in the "Middle" field, when displayed, still shows the "Object id #". thanks so far! Quote Link to comment https://forums.phpfreaks.com/topic/116098-php-and-mysql-reading-from-msaccess-db-outputs-object-id/#findComment-597082 Share on other sites More sharing options...
imjitin Posted July 5, 2012 Share Posted July 5, 2012 I am also facing the same issue. Please help to short out this issue.. Quote Link to comment https://forums.phpfreaks.com/topic/116098-php-and-mysql-reading-from-msaccess-db-outputs-object-id/#findComment-1359297 Share on other sites More sharing options...
trq Posted July 5, 2012 Share Posted July 5, 2012 Post your problematic code. Quote Link to comment https://forums.phpfreaks.com/topic/116098-php-and-mysql-reading-from-msaccess-db-outputs-object-id/#findComment-1359326 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.