Forums

PHP

This topic is locked

ASP to PHP Code

Posted 21 Apr 2006 01:35:53
1
has voted
21 Apr 2006 01:35:53 Joey Washburn posted:
I am working on porting some stuff to PHP from ASP for reasons to long to list here.

Anyway I have this piece of code from my current ASP page

<pre id=code><font face=courier size=2 id=code> &lt;%

While ((Repeat1__numRows &lt;&gt; 0) AND (NOT rsTrack.EOF))
if iTracksLineBreak &gt;=6 then
Response.Write "&lt;/tr&gt;"
response.Write "&lt;tr&gt;"
iTracksLineBreak = 1
End if
%&gt;
&lt;td valign="top"&gt;&lt;p align="center"&gt;&lt;A HREF="detailride.asp?&lt;%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ID=" & rsTrack.Fields.Item("ID".Value %&gt;"&gt;&lt;%=(rsTrack.Fields.Item("DisplayName".Value)%&gt;&lt;/A&gt;&lt;br&gt;
&lt;A HREF="detailride.asp?&lt;%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ID=" & rsTrack.Fields.Item("ID".Value %&gt;"&gt;&lt;img src="&lt;%=(rsTrack.Fields.Item("pic_thumb".Value)%&gt;" alt="" border="0"&gt;&lt;/A&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;%
iTracksLineBreak = iTracksLineBreak + 1
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsTrack.MoveNext()
Wend
%&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;
&lt;%
rsTrack.Close()
Set rsTrack = Nothing
%&gt; </font id=code></pre id=code>

I need help converting it to PHP, I have some of it done, but I cant get this part to work right

<pre id=code><font face=courier size=2 id=code>While ((Repeat1__numRows &lt;&gt; 0) AND (NOT rsTrack.EOF))
if iTracksLineBreak &gt;=6 then
Response.Write "&lt;/tr&gt;"
response.Write "&lt;tr&gt;"
iTracksLineBreak = 1
End if
</font id=code></pre id=code>

Basically I am pulling a record and the thumbnail photos from the database and i want it to display 5 of them across and then line break

Replies

Replied 21 Apr 2006 18:17:14
21 Apr 2006 18:17:14 Roddy Dairion replied:
By the looks of it, it something like

<pre id=code><font face=courier size=2 id=code>
$SQL= "you need a mysql query here"
$query = mysql_query($SQL);
while ($row=mysql_fetch_array($SQL))
{
$i = 0;
if ($i &gt;= 6)
{
echo "&lt;/tr&gt;";
echo "&lt;tr&gt;";
$i++;
}
}
</font id=code></pre id=code>

I might be wrong but this is what it looks like to me.

Reply to this topic