Thanks everyone for the kind comments.
AndreasT: The code is now in the 0.2 version of the snippet, has been tested and works without PHP5.
Code inserted:
if (PHP_VERSION < 5) {
function stripos($haystack, $needle){
return strpos($haystack, stristr( $haystack, $needle ));
}
}
I am also getting more MySQL field types to be recognised by my script. For instance:
For the ’enum’ type, my script sets up a <select></select> field and uses the php explode function to use the enum values as option values.
if (stripos($row["Type"],"enum") !== false) {
$this_row["Type"] = "enum";
$enum_remove = array('enum','(',')','\'');
$this_row["Options"] = explode(',',str_replace($enum_remove,"",$row["Type"]));
}
and then when printing the html...
case "enum":
$output .= "<p class=\"$error_class\"><select name=\"{$table}[{$field["Field"]}]\">";
foreach ($field["Options"] as $value) {
$output .= "<option>" . $value ."</option>";
}
$output .= "</select> $error_text</p>\n";
break;
I am also currently half way through implementing a WHERE clause function to the SELECT forms, using template variables.
Thanks, Andy.