Greetings!
I just want to ask some help and assistance in my problems for my script.
I've got an error.... Any help would be highly appreciated.. thanks
Line 252 is in COLOR RED
...or this one....
LINE 252: if ($comment_row[$w]==$table) $comment=$comment_row['Comment'];
Notice: Undefined offset: 0 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 252
Notice: Undefined offset: 1 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 252
Notice: Undefined offset: 2 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 252
Notice: Undefined offset: 3 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 252
Notice: Undefined offset: 4 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 252
Notice: Undefined offset: 5 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 252
Line 316 and 312 is in COLOR BLUE
.. or this one....
LINE 312: echo "<td><input type='text' name='".$col_name[($c+1)]."' value='".$row[$c]."' size='24'></td>\n";
LINE 316: echo "<td>".$row[$c]."<input type='hidden' name='".$col_name[($c+1)]."' value='".$row[$c]."' size='24'></td>\n";
Notice: Undefined offset: 0 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 316
Notice: Undefined offset: 0 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 316
Notice: Undefined offset: 1 in D:\reports\html\eradmin\er_manager\lookup_table_editor.php on line 312
Here's the script:
function display_table($table)
{
$dblink=dbconn("read", "entitlement_review", "lookup_table_editor.display_table");
// get table comment
$comment_query="show table status from entitlement_review";
$comment_result=mysqli_query($dblink, $comment_query);
$comment_count=mysqli_num_rows($comment_result);
$comment_row=mysqli_fetch_array($comment_result);
for ($w=0; $w < $comment_count; $w++)
{
$comment_row=mysqli_fetch_array($comment_result);
if ($comment_row[$w]==$table) $comment=$comment_row['Comment']; }
$query="select * from entitlement_review.".$table;
$result=mysqli_query($dblink, $query);
$count=mysqli_num_rows($result);
$columns=mysqli_field_count($dblink);
// get column names
/ Get field information for all fields /
$q=0;
while ($finfo = mysqli_fetch_field($result))
{
$q++;
$col_name[$q]=$finfo->name;
}
// echo "<pre>"; print_r($col_name); echo "</pre>\n"; # debug
echo "<center>\n";
echo "<h2>".$table." Table</h2>\n";
echo "<table border='1' bgcolor='blue'><tr><td>\n\n"; // table for blue frame //
echo "<table border='1' bgcolor='white'>\n";
echo "<tr>\n";
for ($h = 1; $h <= $columns; $h++)
{
echo "<th>".$col_name[$h]."</th>\n";
}
echo "<th>Action</th>\n";
echo "</tr>\n";
for ($i = 0; $i < $count; $i++)
{
echo "<tr>";
echo "<form action='lookup_table_editor.php' method='post'>\n";
$row=mysqli_fetch_array($result);
for ($c = 0; $c < $columns; $c++)
{
if ($col_name[($c+1)]!="id" && $col_name[($c+1)]!="EntityID" && $col_name[($c+1)]!="DepartmentID" && $col_name[($c+1)]!="recordid")
{
echo "<td><input type='text' name='".$col_name[($c+1)]."' value='".$row[$c]."' size='24'></td>\n"; }
else
{
echo "<td>".$row[$c]."<input type='hidden' name='".$col_name[($c+1)]."' value='".$row[$c]."' size='24'></td>\n"; }
}
echo "<td>\n";
echo "<input type='hidden' name='table' value='".$table."'>\n";
for ($c = 1; $c < ($columns+1); $c++)
{
echo "<input type='hidden' name='col_name[$c]' value='".$col_name[$c]."'>\n";
}
echo "<input type='submit' name='submit' value='Change'>\n";
if ($table=="apcode")
{
echo " <input type='submit' name='submit' value='Delete'>\n";
}
echo "</td>\n";
echo "</form\n\n";
echo "</tr>\n";
}
add record
echo "<tr>\n";
echo "<form action='lookup_table_editor.php' method='post'>\n";
for ($c = 0; $c < $columns; $c++)
{
if ($col_name[($c+1)]!="id" && $col_name[($c+1)]!="EntityID" && $col_name[($c+1)]!="DepartmentID" && $col_name[($c+1)]!="recordid")
{
echo "<td><input type='text' name='".$col_name[($c+1)]."' size='24'></td>\n";
}
else
{
echo "<td> </td>\n";
}
}
echo "<td>";
for ($c = 1; $c < ($columns+1); $c++)
{
echo "<input type='hidden' name='col_name[$c]' value='".$col_name[$c]."'>\n";
}
echo "<input type='hidden' name='table' value='".$table."'>\n";
echo "<input type='submit' name='submit' value='Add'><td>\n";
echo "</tr>\n";
echo "</form\n\n";
echo "</table>\n";
echo "</td></tr></table>\n\n"; # close table for blue frame
echo "</center>\n";
}