Need some help converting some code
Posted: Thu Apr 20, 2006 10:28 pm
Jcart | Please use
The part I am having trouble with is the While statement. This is what I have come up with so far using the convertor tools and some infromation I have picked up reading around on the net[/syntax]
I get an error on the first line, so something is wrong with the while statement. I believe its the EOF that is doing, I dont think its a variable, but i can find how to do it with PHP
Any help would be appreciated.
Jcart | Please use
Code: Select all
andCode: Select all
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 new to PHP and only a novice at ASP so please hang in there.
I am returning records from a database with a thunbmail image and a name. I want 5 records to be displayed and then a break. I tried an ASP to PHP convertor, but they have proven to not be very reliable.
Here is the code in ASP
[syntax="asp"] <%
While ((Repeat1__numRows <> 0) AND (NOT rsTrack.EOF))
if iTracksLineBreak >=6 then
Response.Write "</tr>"
response.Write "<tr>"
iTracksLineBreak = 1
End if
%>
<td valign="top"><p align="center"><A HREF="detailride.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ID=" & rsTrack.Fields.Item("ID").Value %>"><%=(rsTrack.Fields.Item("DisplayName").Value)%></A><br>
<A HREF="detailride.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ID=" & rsTrack.Fields.Item("ID").Value %>"><img src="<%=(rsTrack.Fields.Item("pic_thumb").Value)%>" alt="" border="0"></A></p>
</td>
<%
iTracksLineBreak = iTracksLineBreak + 1
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsTrack.MoveNext()
Wend
%>Code: Select all
<?
While (($Repeat1__numRows <> 0) AND (NOT $rsTrack.$EOF));
if ($iTracksLineBreak >=6) {
echo "</tr>";
echo "<tr>";
$iTracksLineBreak = 1;
}
?>
<td valign="top"><p align="center"><A HREF="detailride.asp?<?= Server.$HTMLEncode[$MM_keepURL].$MM_joinChar[$MM_keepURL]."ID=".$rsTrack.$Fields.$Item["ID"].$Value ?>"><?=($rsTrack.$Fields.$Item["DisplayName"].$Value)?></A><br>
<A HREF="detailride.asp?<?= Server.$HTMLEncode[$MM_keepURL].$MM_joinChar[$MM_keepURL]."ID=".$rsTrack.$Fields.$Item["ID"].$Value ?>"><img src="<?=($rsTrack.$Fields.$Item["pic_thumb"].$Value)?>" alt="" border="0"></A></p>
</td>
<?
$iTracksLineBreak = $iTracksLineBreak + 1;
$Repeat1__index=$Repeat1__index+1;
$Repeat1__numRows=$Repeat1__numRows-1;
$rsTrack.$MoveNext();
}
?>Any help would be appreciated.
Jcart | Please use
Code: Select all
andCode: Select all
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]