PHP Classes
elePHPant
Icontem

File: example2.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  >  example2.php  >  Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: Example 2 - Editing
Class: MySQL Form Generator
Generate forms to edit data in MySQL tables
Author: By
Last change:
Date: 13 years ago
Size: 1,457 bytes
 

Contents

Class file image Download
<?
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# DB Layer Example Page - Editing #
# 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","","","","2","id = '1'","","");
  
$form->addtable($db1,"table2","","","","2","id = '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>";
             }
        }
?>