Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $table = "<table align='center' border='1' cellpadding='2' cellspacing='2'>";
- $cols = implode (', ', $fields);
- $sql = "select $cols from $table_name";
- $run = mysql_query($sql);
- if($run){
- if(mysql_num_rows($run) == 0){
- return "Sorry. No records found in the database";
- }
- else {
- while($arr = mysql_fetch_array($run, MYSQL_ASSOC)){
- $table .= "\t\t<tr>\n";
- foreach ($arr as $val_col) {
- $newtext = wordwrap($val_col, 30, "<br />\n", true);
- if ($newtext == FAIL) {
- $newtext2 = "<span style='color: rgb(255, 0, 0);'>FAIL</span>";
- }
- elseif ($newtext == PASS) {
- $newtext2 = "<span style='color: rgb(0, 255, 0);'>PASS</span>";
- }
- else {
- $newtext2 = $newtext
- $table .= "\t\t\t".'<td>'.$newtext2.'</td>'."\n";
- } }
- $table .= "\t\t</tr>\n";
- }
- $table .= "</table>";
- return $table;
- }
- mysql_free_result($run);
- }
- echo mysql_error();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement