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 the article "tips on %" that I saw here not only solved the problem very easily, but also extended 2 columns per row to N columns: for example: $ n is Integer ?. SyntaxHighlighter. all ();
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 )."";
}
?>
......