Login   Register  
PHP Classes
elePHPant
Icontem

File: table.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Valics Lehel  >  PHP or Java Class Code Generator  >  table.php  >  Download  
File: table.php
Role: Application script
Content type: text/plain
Description: app script
Class: PHP or Java Class Code Generator
Generate PHP or Java database access classes
Author: By
Last change:
Date: 2008-02-07 12:15
Size: 1,535 bytes
 

Contents

Class file image Download
<?php
include_once("config.inc.php");
include_once(
INCLUDE_PATH."cls_fast_template.php");
include_once(
INCLUDE_PATH."cls_string.php");
session_start();
$stringutil = new String("");
$all_url_vars=array();
$all_url_vars=$stringutil->parse_all();

$all_url_vars["action"]=(empty($all_url_vars["action"])?"add":$all_url_vars["action"]);

if (
$all_url_vars["action"] == "add")
{

$ft = new FastTemplate(TEMPLATE_PATH);
$ft->define(array("main"=>"template_body.html""content"=>"template_fields.html"));
if(!empty(
$_SESSION['host']) && !empty($_SESSION['logid']) && !empty($_SESSION['dbname']) && !empty($all_url_vars["tables"]))
{
    
$cid mysql_connect($_SESSION["host"],$_SESSION["logid"],$_SESSION["pasw"]) or die("Database settings error!</br> Go back <a href='index.php?page=host'> prev</a>.</br> Write correct information!");
mysql_select_db($_SESSION["dbname"]) or die("Database settings error!</br> Go back <a href='index.php?page=host'> prev</a>.</br> Write correct information!");
$fres=mysql_list_fields($_SESSION["dbname"],$all_url_vars["tables"]);
$buffer ="";
$dbuffer ="";
$cols=mysql_num_fields($fres);
for (
$i 0$i $cols$i++) {
        
$t=mysql_field_name($fres,$i);
        
$fieldtype=mysql_field_type ($fres$i);    
        
$buffer .= "<option value=\"$t\">$t</option>";
        
$ft->assign("FIELDS",$buffer);
        
$dbuffer.=$t;
        
$dbuffer.=";";
    }
}
$_SESSION['dbuffer']=$dbuffer;
$_SESSION['table']=$all_url_vars["tables"];
$ft->parse("BODY", array("content","main"));
$ft->FastPrint();
}


?>