trouble converting asp code to php
Posted: Thu Jun 01, 2006 9:11 am
Weirdan | Please use
Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am a newbie to php. I have used asp for years. I have some asp code that I am trying to convert to php. I think I have got most of the code converted correctly, however, I am getting a T_STRING parse error.
I thought someone might glance at the code below and tell me if they see anything wrong. What has taken me days, I'm sure will take an expert seconds.
If there are any errors anywhere - could someone correct me??
Here is the code I have converted:
The code between the ********************** marks is where I am getting the parse error.Code: Select all
<?php
$db = 'C:\\Inetpub\\wwwroot\\accord\\database\\Accord.mdb';
$conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db") or exit('Cannot open with Jet.');
$sParent = $temp=Trim(Request("Parent"));
If ($sParent == "") {
$sParent = Null;
}
$CATEGORY_TABLE = "Page_category";
$INFO_TABLE = "PageInfo";
$sql="SELECT PageInfo.ID, PageInfo.Description FROM PageInfo INNER JOIN Page_category ON PageInfo.Category = Page_category.Category_ID WHERE PageInfo.Category LIKE '%" & sParent & "%';
$rs = $conn->Execute($sql);
******************************************************
'Existence Text
If (!$rs->EOF) {
echo "Sorry, there are no pages listed for this category.";
}
Else {
echo "Here are the pages for this category.";
}
******************************************************
?>
'Loop through members
<?php while (!$rs->EOF) { ?>
echo($rs("Description") & "")
<?php $rs->MoveNext() ?>
<?php } ?>
<?
$rs->Close();
$conn->Close();
$rs = null;
$conn = null;
?>Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]