how can i loop through my database and have it print it out into a table...i have this but i need it to loop through three tr's and then go to a new row.
but the line $a=0; in the while ($a>2) {... it seems to ver load the server.PHP Code:$a=0;
while ($a<2) {
while ($row = mysql_fetch_array($data)) {
echo"<td>";
echo $row['alumni_name']; echo $a;
echo"</td>";
$a = $a+1;
while ($a>2) {
echo"</tr>";
$a=0;
};
};
};
does anyone have a better way of doing this? i have done it in asp which was originaly how it was but we are moving server and i dont know how to do this...can someone help me thanks. if you want to see what i mean by what i want to do in asp http://www33.brinkster.com/clrkkid/alumni.asp and if you want to see the asp code here it is...
thanks.Code:if intCurr=0 then response.write("<tr>") 'Response(oRS("alumni_id")) Response.Write("<td>") Response.Write("<b>" & oRS("alumni_name").Value & "</b><br>") Response.Write(oRS("alumni_year").Value & "<br>") Response.Write(oRS("alumni_adress").Value & "<br>") Response.Write(oRS("alumni_phone").Value & "<br>") Response.Write(oRS("alumni_email").Value & "<br>") Response.Write(oRS("alumni_afterschool").Value & "<br><br>") Response.Write("</td>") oRS.MoveNext intCurr = intCurr+1 if intCurr=3 then response.write("</tr>") intCurr=0 end if Loop if intCurr<>0 then response.write("</tr>")




Reply With Quote