PHP Classes

File: addfield2.php

Recommend this page to a friend!
  Classes of Marius  >  dbFile  >  addfield2.php  >  Download  
File: addfield2.php
Role: Application script
Content type: text/plain
Description: addfield2.php
Class: dbFile
file based web database and Administrator
Author: By
Last change:
Date: 18 years ago
Size: 949 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>Add new field to table <?php print("$TABLE"); ?></title>
        <link rel="stylesheet" href="settings.css" type="text/css">
</head>

<body>
<br><br><br>
<center>
<?php
include("common.inc");
$dbf->select_db($DB);

if(
$type == 'text') {
$type = "text(255)";
}
else {
    if(!
$Length){
        print(
"Please enter a length for INT, <a href=\"javascript: history.back();\">back</a>");
        die();
    }else{
       
$type = "$type($Length)";
    }
}

if((
$type == 'text' AND $Length != '')) {
    print(
"No need to give a length when defining as TEXT, <a href=\"javascript: history.back();\">back</a>");
}
else {
   
$query = "ALTER TABLE $TABLE ADD COLUMN $COLUMN $type $Flag";
   
$result = $dbf->query($query) or die("ERROR while adding new column, please check your flags.");
    print(
"New field has been added succesfully!");
}
?>
</center>
</body>
</html>

For more information send a message to info at phpclasses dot org.