home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 August / PCWorld_2001-08_cd.bin / Komunikace / phptriad / phptriadsetup2-11.exe / htdocs / phpMyAdmin / tbl_properties.inc.php < prev    next >
Text File  |  2000-08-20  |  6KB  |  198 lines

  1. <!-- $Id: tbl_properties.inc.php,v 1.24 2000/07/13 14:04:38 tobias Exp $ */ -->
  2.  
  3. <form method="post" action="<?php echo $action;?>">
  4. <input type="hidden" name="server" value="<?php echo $server;?>">
  5. <input type="hidden" name="db" value="<?php echo $db;?>">
  6. <input type="hidden" name="table" value="<?php echo $table;?>">
  7. <?php
  8. if($action == "tbl_create.php")
  9. {
  10.     ?>
  11.     <input type="hidden" name="reload" value="true">
  12.     <?php
  13. }
  14. elseif($action == "tbl_addfield.php")
  15. {
  16.     echo '<input type="hidden" name="after_field" value="'.$after_field."\">\n";
  17. }
  18.  
  19. ?>
  20. <table border=<?php echo $cfgBorder;?>>
  21. <tr>
  22. <th><?php echo $strField; ?></th>
  23. <th><?php echo $strType; ?></th>
  24. <th><?php echo $strLengthSet; ?></th>
  25. <th><?php echo $strAttr; ?></th>
  26. <th><?php echo $strNull; ?></th>
  27. <th><?php echo $strDefault; ?></th>
  28. <th><?php echo $strExtra; ?></th>
  29.  
  30. <?php
  31. if($action == "tbl_create.php" || $action == "tbl_addfield.php")
  32. {
  33.     ?>
  34.     <th><?php echo $strPrimary; ?></th>
  35.     <th><?php echo $strIndex; ?></th>
  36.     <th><?php echo $strUnique; ?></th>
  37.     <?php
  38. }
  39. ?>
  40. </tr>
  41.  
  42. <?php
  43. for($i=0 ; $i<$num_fields; $i++)
  44. {
  45.     if(isset($result))
  46.         $row = mysql_fetch_array($result);
  47.     $bgcolor = $cfgBgcolorOne;
  48.     $i % 2  ? 0: $bgcolor = $cfgBgcolorTwo;
  49.     ?>
  50.     <tr bgcolor="<?php echo $bgcolor;?>">
  51.     <td>
  52.       <input type="text" name="field_name[]" size="10" value="<?php if(isset($row) && isset($row["Field"])) echo $row["Field"];?>">
  53.       <input type="hidden" name="field_orig[]" value="<?php if(isset($row) && isset($row["Field"])) echo $row["Field"];?>"></td>
  54.     <td><select name="field_type[]">
  55.     <?php
  56.     $row["Type"] = empty($row["Type"]) ? '' : $row["Type"];
  57.     $Type = stripslashes($row["Type"]);
  58.     $Type = eregi_replace("BINARY", "", $Type);
  59.     $Type = eregi_replace("ZEROFILL", "", $Type);
  60.     $Type = eregi_replace("UNSIGNED", "", $Type);
  61. //  $Length = eregi_replace("$Type|\\(|\\)", "", $Type);
  62. //  Strange: $Type would always match $Type, so replaced with version below:
  63. //  I Huneke (Logica) 29 September 1999
  64.     #$Length = eregi_replace("\\(|\\)", "", $Type);
  65.     $Length = $Type;
  66.     $Type = eregi_replace("\\(.*\\)", "", $Type);
  67.     $Type = chop($Type);
  68. //  Add test to ensure we're not trying to replace blank with blank
  69. //  I Huneke (Logica) 29 September 1999
  70.     if(!empty($Type))
  71.     {
  72.         $Length = eregi_replace("^$Type\(", "", $Length);
  73.         $Length = eregi_replace("\)$", "", trim($Length));
  74.     }
  75.     $Length = htmlspecialchars(chop($Length));
  76.     if($Length == $Type)
  77.         $Length = "";
  78.     for($j=0;$j<count($cfgColumnTypes);$j++)
  79.     {
  80.         echo "<option value=$cfgColumnTypes[$j]";
  81.         if(strtoupper($Type) == strtoupper($cfgColumnTypes[$j]))
  82.             echo " selected";
  83.         echo ">$cfgColumnTypes[$j]</option>\n";
  84.     }
  85.     ?>
  86.      </select>
  87.     </td>
  88.     <td><input type="text" name="field_length[]" size="8" value="<?php echo $Length;?>"></td>
  89.     <td><select name="field_attribute[]">
  90.     <?php
  91.     $binary   = eregi("BINARY", $row["Type"], $test_attribute1);
  92.     $unsigned = eregi("UNSIGNED", $row["Type"], $test_attribute2);
  93.     $zerofill = eregi("ZEROFILL", $row["Type"], $test_attribute3);
  94.     $strAttribute = "";
  95.     if($binary)
  96.         $strAttribute="BINARY";
  97.     if($unsigned)
  98.         $strAttribute="UNSIGNED";
  99.     if($zerofill)
  100.         $strAttribute="UNSIGNED ZEROFILL";
  101.     for($j=0;$j<count($cfgAttributeTypes);$j++)
  102.     {
  103.         echo "<option value=\"$cfgAttributeTypes[$j]\"";
  104.         if(strtoupper($strAttribute) == strtoupper($cfgAttributeTypes[$j]))
  105.             echo " selected";
  106.         echo ">$cfgAttributeTypes[$j]</option>\n";
  107.     }
  108.     ?>
  109.     </select></td>
  110.     <td><select name="field_null[]">
  111.     <?php
  112.     if(!isset($row) || !isset($row["Null"]) || $row["Null"] == "")
  113.     {
  114.         ?>
  115.         <option value=" not null">not null</option>
  116.         <option value="">null</option>
  117.         <?php
  118.     }
  119.     else
  120.     {
  121.         ?>
  122.         <option value="">null</option>
  123.         <option value="not null">not null</option>
  124.         <?php
  125.     }
  126.     ?>
  127.     </select></td>
  128.     <td><input type="text" name="field_default[]" size="8" value="<?php if(isset($row) && isset($row["Default"])) echo $row["Default"];?>"></td>
  129.     <td><select name="field_extra[]">
  130.     <?php
  131.     if(!isset($row) || !isset($row["Extra"]) || $row["Extra"] == "")
  132.     {
  133.         ?>
  134.         <option value=""></option>
  135.         <option value="AUTO_INCREMENT">auto_increment</option>
  136.         <?php
  137.     }
  138.     else
  139.     {
  140.         ?>
  141.         <option value="AUTO_INCREMENT">auto_increment</option>
  142.         <option value=""></option>
  143.         <?php
  144.     }
  145.     ?>
  146.     </select></td>
  147.  
  148.     <?php
  149.     if($action == "tbl_create.php" || $action == "tbl_addfield.php")
  150.     {
  151.         ?>
  152.         <td align="center">
  153.         <input type="checkbox" name="field_primary[]" value="<?php echo $i;?>"
  154.         <?php
  155.         if(isset($row) && isset($row["Key"]) && $row["Key"] == "PRI")
  156.             echo "checked";
  157.         ?>
  158.         >
  159.         </td>
  160.         <td align="center">
  161.         <input type="checkbox" name="field_index[]" value="<?php echo $i;?>"
  162.         <?php
  163.         if(isset($row) && isset($row["Key"]) && $row["Key"] == "MUL")
  164.             echo "checked";
  165.         ?>
  166.         >
  167.         </td>
  168.         <td align="center">
  169.             <input type="checkbox" name="field_unique[]" value="<?php echo $i;?>"
  170.         <?php
  171.         if(isset($row) && isset($row["Key"]) && $row["Key"] == "UNI")
  172.             echo "checked";
  173.         ?>
  174.         >
  175.         </td>
  176.         <?php
  177.     }
  178.     ?>
  179.     </tr>
  180.     <?php
  181. }
  182. ?>
  183. </table>
  184. <?php
  185. if($action == "tbl_create.php" && MYSQL_MAJOR_VERSION == "3.23")
  186. {
  187.     echo "$strTableComments:<br>";
  188.     ?>
  189.     <input type="text" name="comment" style="width: <?php echo $cfgMaxInputsize;?>" maxlength="80">
  190.     <?php
  191. }
  192. ?>
  193. <p>
  194. <input type="submit" name="submit" value="<?php echo $strSave;?>">
  195. </p>
  196. </form>
  197. <center><?php print show_docu("manual_Reference.html#Create_table");?></center>
  198.