/ Published in: PHP
Use this function to print out all the rows in a table. Specify columns to show using the columnstring parameter:
tablulardata(tablename, columnstring);
ie:
tabluardata("users","username=Username|fname=First Name|lname=Last Name");
tablulardata(tablename, columnstring);
ie:
tabluardata("users","username=Username|fname=First Name|lname=Last Name");
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function tabulardata($tablename,$columnstring){ //Get field data echo("<table>\n"); echo("<tr>\n"); foreach($columns as $column){ $columntitle = $columninfo[1]; $columnnames[] = $columninfo[0]; }else{ $columntitle = $column; $columnnames[] = $column; } echo("<td>".$columntitle."</td>\n"); } echo("</tr>\n"); echo("<tr>\n"); foreach($field_array as $field_key=>$field_value){ echo("<td>".$field_value."</td>\n"); } } echo("</tr>\n"); } echo("</table>"); } }
URL: http://www.jeffkilroy.com