The best way to place data into N columns per row in a Table. When I was writing a program today, I encountered a problem: how to display the data retrieved from the database in the format of two columns per row. I think of an article I saw here -- "When I was writing a program today, I encountered a problem: how to format the data retrieved from the database in two columns per row
Displayed. I think of an article I have seen here-"tips on %", which not only solves this problem very simply.
Problem, but also expand 2 columns in each row to N columns:
For example, $ n is an Integer.
?>
......
$ SQL = "select id, subject from new ";
Ora_parse ($ cursor, $ SQL );
Ora_exec ($ cursor );
$ I = 0;
While (ora_fetch ($ cursor ))
{
$ I ++;
If ($ I % $ n = 1)
{
Echo ""
Echo "". ora_getcolumn ($ cursor, 1 )."";
}
Elseif ($ I % $ n = 0)
{
Echo "". ora_getcolumn ($ cursor, 1 )."";
Echo "";
}
Else
Echo "". ora_getcolumn ($ cursor, 1 )."";
}
?>
......
The token is displayed. I think of an article I saw here -- "close...