dbases/power/definitions.php - ERROR: couldn't connect to server");
$typetxt = array("unknown","2x200 Amps","3x150+50 Amps","3x100+4x50 Amps","nx22 Amps");
$statarray = array("good","broken","maintainance","recalibration");
function Array_to_HTML_Table($array,$size){ // pass the array and the number of table columns
$table_width = 100; // assumes 100% table width
$width = intval($table_width/$size); // width
$tr = ' | ';
$row = $tr;
$td = '%s | '; // sprintf() requires %% to get %
// loop over entries and display in rows of size $size
$i = 0; // $i counts table rows
foreach($array as $e){
$row .= sprintf($td,$e);
$i++;
// end of row; close it and open a new one:
if(!($i % $size)) {$row .= "
$tr";}
}
// pad out remaining cells with blanks
while($i % $size){
$row .= sprintf($td,' ');
$i++;
}
// add if necessary
$end_tr_len = strlen($tr)-1;
if(substr($row,$end_tr_len) != $tr) {
$row .= '';
} else {
$row = substr($row,0,$end_tr_len);
}
return $row;
}
?>