align="justify"> lt;/tr gt; lt;/table gt; lt;/form gt; lt;/body gt; lt;/html gt; .php
lt;? php_reporting (0); (! isset ($ db))
{$ hostname= localhost raquo ;;
$ username= root raquo ;;
$ password= raquo ;; _connect ($ hostname, $ username, $ password) or die ( Помилка конекту !! );
$ db= Hot_admin raquo ;; _ select_db ($ db) or die (mysql_error ()); _ query ( SET NAMES cp1251 ); _ query ( SET CHARACTER SET cp1251 );} CheckDup ($ tbl, $ field, $ value) {
$ res=mysql_query ( SELECT * FROM $ tbl where $ field=$valueraquo;);(mysql_fetch_row($res)){1;}{0;}}GetRow($sql){mysql_fetch_row(mysql_query($sql));}RowToForm($tbl,$id)
{$ db=$ GLOBALS [ db ];
$ list_f=mysql_list_fields ($ db, $ tbl);
$ name_f=mysql_field_name ($ list_f, 0);
$ Cur=mysql_fetch_row (mysql_query ( select * from $ tbl where $ name_f=$ id; )); $ Cur;} getNext ($ tbl, $ cur)
{$ db=$ GLOBALS [ db ];
$ list_f=mysql_list_fields ($ db, $ tbl);
$ name_f=mysql_field_name ($ list_f, 0);
$ res=mysql_query ( SELECT $ name_f FROM $ tbl WHERE $ name_f gt; $ cur ORDER BY $ name_f ASC LIMIT 1 ); ($ next=mysql_fetch_row ($ res)) {RowToForm ( $ tbl, $ next [0]);} return RowToForm ($ tbl, $ cur);} getPrev ($ tbl, $ cur) {
$ db=$ GLOBALS [ db ];
$ list_f=mysql_list_fields ($ db, $ tbl);
$ name_f=mysql_field_name ($ list_f, 0);
$ res=mysql_query ( SELECT $ name_f FROM $ tbl WHERE $ name_f lt; $ cur ORDER BY $ name_f DESC LIMIT 1raquo;);($prev=mysql_fetch_row($res)){RowToForm($tbl,$prev[0]);}RowToForm($tbl,$cur);}insert($tbl)
{$ db=$ GLOBALS [ db ];
$ list_f=mysql_list_fields ($ db, $ tbl);
$ n=mysql_num_fields ($ list_f);
$ name_f=mysql_field_name ($ list_f, 0);
$ value=$ _POST [$ name_f]; (CheckDup ($ tbl, $ name_f, $ value)) {
$ sql= Update $ tbl SET raquo ;;
$ wh=$ where= where $ name_f=$ value raquo ;; } {
$ wh= where $ name_f in (select max ($ name_f) from $ tbl) raquo ;;
$ sql= INSERT INTO $ tbl SET raquo ;; } ($ i=0; $ i lt; $ n; $ i ++) {
$ name_f=mysql_field_name ($ list_f, $ i); ($ name_f!= id ) {
$ value=$ _POST [$ name_f];
$ j=$ i + 1;
$ sql=$ sql. $ name_f. = Laquo; $ value raquo ;; ($ j lt; gt; $ n) $ sql=$ sql. Laquo ;, raquo ;;}} (isset ($ where)) {
$ sql.=$ where;} _ query ($ sql) or die (mysql_error ());
$ res=mysql_query ( select * from $ tbl $ wh ); mysql_fetch_row ($ res);} View ($ tbl, $ NeedHead) {(! stristr (strtoupper ($ tbl) , SELECT )) {($ NeedHead)
{echo lt; b gt; $ Tbl lt;/b gt; lt; table border=1 gt; raquo ;;
$ result=mysql_query ( describe $ tbl; ); lt; tr gt; raquo ;; ($ myrow=mysql_fetch_row ($ result)) { lt; td gt; $ myrow [0] lt;/td gt; raquo ;; } lt;/tr gt; raquo ;;}
$ result=mysql_query ( select * from $ tbl; ); } {$ Result=mysql_query ($ tbl);} ($ myrow=mysql_fetch_row ($ result))
{echo lt; tr gt; raquo ;; for ($ i=0; $ i lt; count ($ myrow); $ i ++) { lt; td gt; $ myrow [$ i ] lt;/td gt; raquo ;; } echo laquo;lt;/trgt;raquo;;}laquo;lt;/tablegt;lt;pgt;raquo;;mysql_close();}delete_record($tbl,$id)
{$ db=$ GLOBALS [ db ];
$ list_f=mysql_list_fields ($ db, $ tbl);
$ name_f=mysql_field_name ($ list_f, 0);
$ sql= Delete from $ tbl where $ name_f=$ id raquo ;;
$ result=mysql_query ($ sql) or die (mysql_error ());
$ res=mysql_query ( select * from $ tbl where $ name_f in (select min ($ name_f) from $ tbl) ); return mysql_fetch_row ($ res);} GetPickData ($ sqlActive, $ sqlDisable, $ field, $ name, $ selection)
{echo lt; select name=" $ name " gt; raquo ;;
$ res=mysql_query ($ sqlActive); ($ row=mysql_fetch_row ($ res))
{if ($ selection == $ row [0])
{echo lt; option selected value=" $ row [0] " gt; $ row [$ field] lt;/option gt; raquo ;; } else lt; option value=" $ row [0] " gt; $ row [$ field] lt;/option gt; raquo ;; } ($ sqlDisable!= ) {<...