$name.
"; $_SESSION['Dt_name']="ModifyJPRTables"; //start the document //---------------------Includes-----------------------------------------------// require_once("../php_PPr/connect_mysql.php"); require_once("../php_common/common_functions.inc"); $action=$_GET['action']; $Table =$_POST['table']; if($action=="submit"){ $table = $_GET['table']; $col = array(); $col = get_fields_from_table($table); $field_string =""; for ($i=0; $i alert('Please enter a Name.'); window.back();"); } if($typecol == "--Type--"){ die(""); } $safename = preg_replace('/[^a-zA-Z0-9]/i', '', $namecol); $safetable= preg_replace('/[^a-zA-Z0-9]/i', '', $table); //echo"safename: $safename"; $fields = get_fields_from_table($safetable); $after = $fields[sizeof($fields)-4]; //before comment $query="ALTER TABLE PPrDB_Development.$safetable ADD `".$safename."` ".$typecol." NULL AFTER `".$after."` "; $result=mysql_call($query); $safehistory =$safetable."Newhistory"; $query="ALTER TABLE PPrDB_Development.$safehistory ADD `".$safename."` ".$typecol." NULL AFTER `".$after."` "; $result=mysql_call($query); header("Location: modify_page.php?table=$table"); } else{ show_menu_ROD(); display_table(); add_field_menu(); } function show_menu_ROD(){ echo"

"; //echo"Change your password

"; echo"
"; echo"
"; //xxx PATH echo " JEP-Crate PSU JEM Input Control G-link

"; } function display_table(){ $table=get_table(); //echo"t: $table"; echo"
"; //echo"Change your password

"; echo"
"; echo"
"; //xxx PATH get_fields(); echo"



"; } function add_field_menu(){ $table=get_table(); echo"
"; //echo"Change your password

"; echo"
"; echo"






"; } function get_fields_only(){ $table = get_table(); $columns = mysql_query("SHOW COLUMNS from $table") or die ("Could not get COLUMNS"); $numcolumns = mysql_num_rows($columns); $x = 0; while( $x < $numcolumns){ $colname = mysql_fetch_row($columns); $col[$x] = $colname[0]; $x++; } return $col; } function get_fields_from_table($table){ $columns = mysql_query("SHOW COLUMNS from $table") or die ("Could not get COLUMNS2"); $numcolumns = mysql_num_rows($columns); $x = 0; while( $x < $numcolumns){ $colname = mysql_fetch_row($columns); $col[$x] = $colname[0]; $x++; } return $col; } function get_fields(){ $table = get_table(); $columns = mysql_query("SHOW COLUMNS from $table") or die ("Could not get COLUMNS"); $numcolumns = mysql_num_rows($columns); $x = 0; while( $x < $numcolumns){ $colname = mysql_fetch_row($columns); $col[$x] = $colname[0]; $x++; } for ($i=0; $i $col[$i]
"; } else{ echo" $col[$i]
"; } } else{ if($val == "Log File" || $val == "Root File" || $val == "Document"){ echo" $col[$i]
"; } else{ echo" $col[$i]
"; } } } } function get_table(){ $action=$_GET['table']; //echo"a: $action"; if ($action == "JEMCrate"){$table = "JEMCrate";} elseif ($action == "JEMPSU"){$table = "JEMPSU";} elseif ($action == "JEModule"){$table = "JEModule";} elseif ($action == "JEMInput"){$table = "JEMInput";} elseif ($action == "JEMControl"){$table = "JEMControl";} elseif ($action == "JEMGlink"){$table = "JEMGlink";} else{ $table = "JEMCrate";}//default return $table; } echo"

"; //------------------------------- //---------include tail---------- //------------------------------- include("../tail.php"); ?>