ASP to PHP: First successful step
| From: | gus | Date: | Mon, 27 Mar 2000 18:53:53 +0000 |
| Subject: | ASP to PHP: First successful step | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12684@lists.php.net to get a copy of this message | ||
Hi!
With the new Beta4 release I started a new try converting my ASP
scripts to PHP. And right now I've successfully rewritten a JScript
ASP accessing Microsoft Index Server which I want to share with you.
Bye and thanks for your support
Guido
------- snip ------- snip ------- snip ------- snip -------
The new PHP script:
<html><head></head>
<body>
<h1>Index-Server Test for PHP4</h1>
<table border=1>
<?php
$q = new COM("ixsso.Query");
$q->Query = "@contents Arztbesuch";
$q->Catalog = "Archiv";
$q->SortBy = "rank[d]";
$q->Columns = "characterization, path, write, DocKeywords";
$q->MaxRecords = 200;
$rs = $q->CreateRecordSet("nonsequential");
$rs->PageSize = 10;
if (!$rs->EOF) {
$c = 0;
while (!($rs->EOF) && ($c<$rs->PageSize)) {
echo "<tr>";
for ($i=0; $i<$rs->Fields->Count; $i++) {
$fld = $rs->Fields($i);
echo "<td>".$fld->Value."</td>";
}
echo "</tr>\n";
$rs->MoveNext();
$c++;
}
$rs->Close();
} else {
echo "EOF";
}
?>
</table>
</body>
</html>
------- snip ------- snip ------- snip ------- snip -------
The original ASP script:
<%@LANGUAGE=JScript%>
<html><head></head>
<body>
<h1>Index-Server Test for ASP</h1>
<table border=1>
<%
var q = new ActiveXObject("ixsso.Query");
q.Query = "@contents Arztbesuch";
q.Catalog = "Archiv";
q.SortBy = "rank[d]";
q.Columns = "characterization, path, write, DocKeywords";
q.MaxRecords = 200;
rs = q.CreateRecordSet("nonsequential");
rs.PageSize = 10;
if (!rs.EOF) {
c = 0;
while (!(rs.EOF) && (c<rs.PageSize)) {
Response.Write("<tr>");
for (var i=0; i<rs.Fields.Count; i++) {
Response.Write("<td>"+rs.Fields(i).Value+"</td>");
}
Response.Write("</tr>\n");
rs.MoveNext();
c++;
}
rs.Close();
} else {
Response.Write("EOF");
}
%>
</table>
</body>
</html>