I'm new to ASP and PHP! I have some ASP code which use recordset and I'm trying to figure out how it translates into PHP.
I have listed some sample code and any help would be appreciated.
Thanks!
// Sample code starts
SQL="Select * from categories "
SQL=sql & " Where highercategoryid=0 order by " & Getconfig("xsortcategories")
OpenRecordSet dbc, rs, sql
While Not rs.EOF
lngcatid=rs("categoryid")
strcategory=rs("catdescription")
strsubcategory=rs("hassubcategory")
strcatimage=rs("catimage") ' image
strcathide=rs("cathide") ' hide field
if isnull(strcathide) then
strcathide="No"
end if
if isNull(strcatimage) then
strcatimage=""
end if
if isNULL(strsubcategory) then
strsubcategory=""
end if
If isnull(strcategory) then
strcathide="Yes"
end if
OldFormatCategory lngcatid, strcategory
rs.MoveNext
Wend
Sub ShopOpenRecordSet (mysql, rstemp, mypagesize, mypage)
if dbc="" then
exit sub
end if
If mysql="" Then
shoperror LangRestart
end if
Set rstemp = Server.CreateObject("ADODB.RecordSet")
rstemp.cursorlocation=aduseclient
If getconfig("xmysql")<>"Yes" then
rstemp.cachesize=5
end if
if getconfig("xdebug")="Yes" then
DebugWrite mysql
end if
rstemp.Open MYSQL,dbc,adOpenKeyset,adLockReadOnly, adCmdText
if not rstemp.eof then
rstemp.movefirst
rstemp.pagesize=mypagesize
maxpages=cint(rstemp.pagecount)
maxrecs=cint(rstemp.pagesize)
rstemp.absolutepage=mypage
end if
end sub
Sub OpenRecordSet (conn, irs, isql)
Set irs=conn.execute(isql)
end sub
// End sample code