The code below works on my server but shows the following problems at my ISP (win server 2003, php 5.0). I can make insert but no select from php to microsoft sql 2000.
The script shows 'object' inplace of any data where such syntax($CurrentUser=$rs->Fields(0);) are used.
NB: The same code can successfully perform insert and can show the number of fields using ($num_columns = $rs->Fields->Count();)
What correction or modification can apply (my ISP wont change their php setting, is there some way round)
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("Provider=SQLOLEDB.1;Data Source= servername;User ID=user;Password=password;Initial Catalog=db_name;");
$query="SELECT currentUser FROM ActivityLog WHERE sessionid = (select Max(sessionID) from ActivityLog)" ;
$rs = $conn->Execute($query); // Recordset
$num_columns = $rs->Fields->Count();
$CurrentUser=$rs->Fields(0);
echo '<p>' . $num_columns . '</p>';
echo '<p>' . $CurrentUser . '</p>';
Can make insert but no select from php
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Don't forget to use
Code: Select all
when posting PHP code.