Login   Register  
PHP Classes
elePHPant
Icontem

File: example1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tobie van der Spuy  >  MySQL Form Generator  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: Example 1 - Inserting
Class: MySQL Form Generator
Generate forms to edit data in MySQL tables
Author: By
Last change:
Date: 13 years ago
Size: 1,441 bytes
 

Contents

Class file image Download
<?
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
#                                                         #
#           DB Layer Example Page - Inserting             #
#           Tobie van der Spuy - 2001                     #
#           glow@gamersinc.co.za                          #
#                                                         #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

// Require Class Library
// =====================
   
require('classes.inc.php');


// Prepare Form
// ============
   
$db1 = new MySQLDB("mfgc","guest","guest","localhost");
   
$db1->select();
   
$form = new Form("form","Files",$PHP_SELF,"","","","none");
   
$form->addtable($db1,"table1","","","","1","","","");
   
$form->addtable($db1,"table2","","","","1","","","");
   
$form->makefields();
   
$form->describe("Row ID:/:/Row Surname:/:/Row Active?/:/Row ID:/:/Row Name:/:/Row Description:/:/Row Extra:");
   
$submitvalue $form->submit;
   

// If not submitted, display form, else display result
// ===================================================
   
if (!$$submitvalue) {
         echo 
$form->build("200","10","200","3","40");
      }
   else {
           if (
$form->submit()) {
           echo 
$form->result("200","10","200");
           echo 
"<a href=$PHP_SELF>Back</a>";
           }
        else {
             echo 
$error;
             echo 
mysql_error();
             echo 
"\n<br><a href=$PHP_SELF>Back</a>";
             }
        }
?>