I have an old existing internal web app in PHP/mysql that I have been debugging after we were forced to eliminate register_globals. I'm no PHP programmer, but I seem to have most of the errors fixed and the site seems 99% functional. I'm stumped on this one though. The code works, and I believe the line in question pads the end of the table. I get a null (blank) undefined index error with every page load on this line:
$results[$label] || $results[$label] = " ";
A more complete look here:
$cols = 4;
$order = array();
$rows = ceil( count($labels) / $cols);
$labels = array_pad($labels, $cols*$rows, '');
$newlabels = array_chunk($labels, $rows);
for ($i = 0; $i < count($newlabels[0]); $i++) {
for ($j = 0; $j < count($newlabels); $j++) {
array_push($order, $newlabels[$j][$i]);
}
}
echo "<p>";
echo "<table width=100% border=1 noshade>";
$form = "general-add-form.php";
$anchor = " <a href=\"$form?tablename=$tablename&col1=$col1&ID=$ID\">
$results[$col1]</a>";
echo "<tr>
<th>$col1</th><td>$anchor</td>
<th>$col2</th><td>$results[$col2]</td>
</tr>";
echo "<tr>";
foreach ($order as $label) {
$results[$label] || $results[$label] = " ";
echo "<th>", ucfirst($label), "</th>";
echo "<td>$results[$label]</td>";
$z++; if ( ! ($z % $cols) ) echo "</tr><tr>";
}