function display_errors($errors)
{
echo "\n".'
';
echo "\n".'';
for($i=0; $i< count($errors); $i++){
echo "\n".htmlspecialchars($errors[$i]);
echo $i < (count($errors)-1) ? ' ' : '';
}
echo "\n".' |
';
};
// phpMyEdit-based user input validation script for MySQL table `colors`
// Works with functions defined in functions.php
$errors = array();
// Un-comment and/or edit the validation criteria to meet your needs.
// Beware of UNIQUE keys other than column 0 auto_increment.
// MySQL column 0: id - smallint() unsigned - not_null primary_key unsigned auto_increment
if($newvals['id'] != '' && !is_numeric($newvals['id'])) { $errors[] = 'Please enter numeric data for Id'; }
// MySQL column 1: name - char(20) - not_null multiple_key
// Validation of user input for "name" may be required
if(empty($newvals['name'])) { $errors[] = 'Please enter a Name'; }
// MySQL column 2: hex - char(7) - not_null
// Validation of user input for "hex" may be required
if(empty($newvals['hex'])) { $errors[] = 'Please enter a Hex'; }
if(empty($errors)){
return true;
}elseif(!empty($errors)){
display_errors($errors);
@mysql_close($this->dbh);
require_once('./inc/footer.php');
exit;
}