" 。
""; $result .= "gt;"; $result を返す; }
関数 fieldFromType ($text, $type) { if ($type == "int" || $type == "uint" || $type == "real") { $結果 = $文章; } else { $result = "'" 。 AddSlashes ($text) 。 ""; } return $result; }
関数 executeMsql ($database, $command) { /*echo "" 。 $コマンド 。 " ";*/ msql ($database, $command); }
関数 handleRemove ($database, $table, $fieldsNumber, $fieldNames, $fieldLengths, $fieldTypes) { グローバル $remove; if ($remove != "") { $command = "DELETE FROM " 。 $テーブル 。 " どこ "; $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $fieldName = "old-" 。 $fieldNames [$fieldIndex]; グローバル $$フィールド名; $command .= $fieldNames [$fieldIndex] 。 「= 。 fieldFromType ($$fieldName, $fieldTypes [$fieldIndex]); if ($fieldIndex != $fieldsNumber - 1) { $command .= " AND "; } $fieldIndex++; } executeMsql ($database, $command); } }
関数 handleUpdate ($database, $table, $fieldsNumber, $fieldNames, $fieldLengths, $fieldTypes) { グローバル $update; if ($update != "") { $command = "UPDATE " 。 $テーブル 。 " セット "; $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $fieldName = $fieldNames [$fieldIndex]; グローバル $$フィールド名; $command .= $fieldName 。 「= 。 fieldFromType ($$fieldName, $fieldTypes [$fieldIndex]); if ($fieldIndex != $fieldsNumber - 1) { $command .= ", "; } $fieldIndex++; } $command .= " WHERE "; $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $fieldName = "old-" 。 $fieldNames [$fieldIndex]; グローバル $$フィールド名; $command .= $fieldNames [$fieldIndex] 。 「= 。 fieldFromType ($$fieldName, $fieldTypes [$fieldIndex]); if ($fieldIndex != $fieldsNumber - 1) { $command .= " AND "; } $fieldIndex++; } executeMsql ($database, $command); } }
関数 handleAdd ($database, $table, $fieldsNumber, $fieldNames, $fieldLengths, $fieldTypes) { global $add; if ($add != "") { $command = "INSERT INTO " 。 $テーブル 。 " ("; $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $command .= $fieldNames [$fieldIndex]; if ($fieldIndex != $fieldsNumber - 1) { $command .= ", "; } $fieldIndex++; } $command .= ") VALUES ("; $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $fieldName = $fieldNames [$ fieldIndex]; global $$fieldName; $command .= fieldFromType ($$fieldName, $fieldTypes [$fieldIndex]); if ($fieldIndex != $fieldsNumber - 1) { $command .= ", "; } $fieldIndex++; } $command .= ")"; executeMsql ($database, $command); } }
関数 displayRemoveUpdate ($database, $table, $sortColumn, $fieldsNumber, $fieldNames, $fieldLengths) { $result = ""; if ($sortColumn != "") { $sortColumn = " ORDER BY " 。 $sortColumn; } $msqlresult = msql ($database, "SELECT * FROM " . $table . $sortColumn); $tuplesNumber = msql_numrows ($msqlresult); $tupleIndex = 0; while ($tupleIndex < $tupleNumber) { $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $values [$fieldIndex] = msql_result ($msqlresult, $tupleIn dex、 $fieldNames [$fieldIndex]); $fieldIndex++; } $result .= displayTuple ($fieldsNumber, $fieldNames, $fieldLengths, $values, "modify"); $tupleIndex++; } return $result; }
関数 displayAdd ($fieldsNumber, $fieldNames, $fieldLengths) { $result = ""; $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $values [$fieldIndex] = ""; $fieldIndex++; } $result .= displayTuple ($fieldsNumber, $fieldNames, $fieldLengths, $values, "add"); msql_close (); $result を返す; }
関数 administrationTable ($database, $table, $sortColumn) { $result = ""; msql_connect ( "localhost"); $msqlresult = msql ($database, "SELECT * FROM " . $table); $fieldsNumber = msql_numfields ($msqlresult); $msqlresult = msql_listfields ($database, $table); $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $fieldNames [$fieldIndex] = msql_fieldname ($msqlresult, $fieldIndex); $fieldLengths [$fieldIndex] = msql_fieldlen ($msqlresult, $fieldIndex); $fieldTypes [$fieldIndex] = msql_fieldtype ($msqlresult, $fieldIndex); $fieldIndex++; } handleRemove ($database, $table, $fieldsNumber, $fieldNames, $fieldLengths, $fieldTypes); handleUpdate ($database, $table, $fieldsNumber, $fieldNames, $fieldLengths, $fieldTypes); handleAdd ($database, $table, $fieldsNumber, $fieldNames, $fieldLengths, $fieldTypes); $result .= displayRemoveUpdate ($database, $table, $sortColumn, $fieldsNumber, $fieldNames, $fieldLengths); $result .= displayAdd ($fieldsNumber, $fieldNames, $fieldLengths); $result を返す; }
関数 addTable ($database, $table) { $result = ""; msql_connect ( "localhost"); $msqlresult = msql ($database, "SELECT * FROM " . $table); $fieldsNumber = msql_numfields ($msqlresult); $msqlresult = msql_listfields ($database, $table); $fieldIndex = 0; while ($fieldIndex < $fieldsNumber) { $fieldNames [$fieldIndex] = msql_fieldname ($msqlresult, $fieldIndex); $fieldLengths [$fieldIndex] = msql_fieldlen ($msqlresult, $fieldIndex); $fieldTypes [$fieldIndex] = msql_fieldtype ($msqlresult, $fieldIndex); $fieldIndex++; } handleAdd ($database, $table, $fieldsNumber, $fieldNames, $fieldLengths, $fieldTypes); $result .= displayAdd ($fieldsNumber, $fieldNames, $fieldLengths); $result を返す; } ?>
http://www.bkjia.com/PHPjc/316182.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/316182.html技術記事 ? /************************************************ ************************************* *SQLAdminv2.0-AnSQLAdministrationUserInterfacefortheWeb * *Copyright(C)1997- 98アレッサンドロ・バーン...
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
著者別の最新記事
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31
|