|
-
Jan 27th, 2003, 02:04 PM
#1
Thread Starter
Frenzied Member
ADODB Record Count? / NEW COM (my dll file)?
OK, i was trying to find out how to implement an activex dll in php, and come accross the com function.
http://www.php.net/manual/en/ref.com.php
[and whoo, can do the (practically - at least) same as with VB]
Anyhow: Record count is returning the value "-1" as if there isn't any records / connection doesnt exsist.
Does any one know what could be the problem?
PHP Code:
<?php
$pagetitle = " - Online Users";
include("header.php");
title("Users Currently In The Chat Server");
OpenTable();
echo "<table align=\"center\" width=\"400\">\n";
echo "<tr>";
echo "<td align=\"center\"><b>Username</b></td>";
echo "<td align=\"center\"><b>Location URL</b></td>";
echo "<td align=\"center\"><b>Login Time</b></td>";
echo "</tr>";
// Create the database connection
$conn = new COM("ADODB.Connection");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\Programming\TheWalksChat\ChatServer\online.mdb");
// Create a new record set
$rs = new COM("ADODB.Recordset");
// open the record set, and select the Username / Location URL / Time Logged In
$rs->Open("select Username, LocationURL, Login_Time from online", $conn);
// This is the record count part <<<<<<<<<<<<<<<<<<<<<<<<
echo $rs->recordcount() ." users online";
// Loop through all of the records in the record set
while (!$rs->EOF){
$username = $rs->Fields(0);
$locationurl = $rs->Fields(1);
$login_time = $rs->Fields(2);
$username = $username->value;
$locationurl = $locationurl->value;
//then start writing the cells in the row, and move to the next record
echo "<tr>";
echo "<td align=\"center\"><a href=\"modules.php?name=Your_Account&op=userinfo&uname=" . $username . "\">" . $username . "</a></td>";
echo "<td align=\"center\"><a href=\"" . $locationurl . "\" target=\"_self\">" . $locationurl . "</a></td>";
echo "<td align=\"center\">" . $login_time->value . "</td>";
echo "</tr>";
// Move to the next record
$rs->movenext();
}
//close the ADO connections and release resources
$rs->Close();
$conn->Close();
$rs = null;
$conn = null;
echo "</table>";
CloseTable();
include("footer.php");
?>
NEXT:
how can i load my own DLL file using the com function, i have tried tons, and cant seam to fix it :\ - ne 1 help me?
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
|