First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
include "db.php";
|
||||
|
||||
$tableName = "schools";
|
||||
if ($argc > 1) $tableName = $argv[1];
|
||||
else {
|
||||
$table = readline("Table (schools): ");
|
||||
if (strlen(trim($table))) $tableName = $table;
|
||||
}
|
||||
|
||||
|
||||
echo("\n");
|
||||
|
||||
$query = "SHOW columns FROM $tableName";
|
||||
$results = db_query($query);
|
||||
|
||||
while ($row = db_fetch_assoc($results)) {
|
||||
$field = $row['Field'];
|
||||
$type = $row['Type'];
|
||||
|
||||
switch ($type) {
|
||||
case 'int':
|
||||
case 'int unsigned':
|
||||
case 'smallint':
|
||||
case 'smallint unsigned':
|
||||
case 'bigint':
|
||||
case 'bigint unsigned':
|
||||
echo('if (!isset($' . $field . ')) $' . $field . " = 0;\n");
|
||||
break;
|
||||
|
||||
case 'decimal(12,2)':
|
||||
echo('if (!isset($' . $field . ')) $' . $field . " = 0.0;\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
echo('if (!isset($' . $field . ')) $' . $field . " = '';\n");
|
||||
}
|
||||
}
|
||||
|
||||
echo("\n");
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user