All pastes #632032 Raw Edit

Stuff

public text v1 · immutable
#632032 ·published 2007-07-24 15:17 UTC
rendered paste body
Hi Neeky, I created tables you requested with few changes on top of the changes
we agreed upon yesterday:

 First is `new_development_package` table which looks like this:

	TABLE new_development_package (
		usr_id				NUMBER(22) not null, 
		building_id 		NUMBER(22) not null, 
		package_id			NUMBER(22) primary key,
		package_date		DATE DEFAULT SYSDATE,
		package_type  		CHAR(1) not null, 
		package_startdate 	DATE DEFAULT SYSDATE,
		package_enddate 	DATE DEFAULT SYSDATE,
		package_active 		CHAR(1)
	);
 
  The package_id is a UNIQUE auto increased value which should serve as unique package <-> microsite identifier as buildings
  are static.
  
  Below is a PHP snipplet to play around with, included for reference:

	<?php
	
		include('db-class.php');
		$db = db_one();
		
		$resultInsert = $db->sql_exec("INSERT INTO new_development_package (usr_id, building_id, package_type, package_enddate, package_active) VALUES ('123', '456', '1', SYSDATE + 30, '1')");
		if($resultInsert) {
			echo 'Inserted a row...<br><br>';
		}
		
		$resultSelect = $db->sql("SELECT * FROM new_development_package");
		if($resultSelect) {
			print_r($resultSelect);
		}
	?>
  
  The `new_development_micrositetab` table consists of:

	TABLE new_development_micrositetab (
		package_id			NUMBER(22) not null,
		tab_name			VARCHAR(20) not null,
		tab_type  			CHAR(1) not null, 
		tab_position 		NUMBER(2) not null,
		tab_text			VARCHAR(2000) not null
	);

  Package_id should be exactly the same UNIQUE 'key' from `new_development_package` table. 
  All tabs should be linked to a package they are for with a package id, and since package table
  will contain building information we do not need it here.
  
  Below is a PHP snipplet to play around with, included for reference:
  
	<?php
	
		include('db-class.php');
		$db = db_one();
		
		$resultInsert = $db->sql_exec("INSERT INTO new_development_micrositetab (package_id, tab_name, tab_type, tab_position, tab_text) VALUES ('123', 'Tab One', '2', '1', 'XML DATA')");
		if($resultInsert) {
			echo 'Inserted a row...<br><br>';
		}
		
		$resultSelect = $db->sql("SELECT * FROM new_development_micrositetab");
		if($resultSelect) {
			print_r($resultSelect);
		}
	?>
	
	
  This structure is more flexible and allows you to create `package <-> (tab pool), package <-> (tab pool), package <-> (tab pool)` seperated by non-static building_id.

  Basicly each campaign = unique package_id.
    
  Thank you and have fun.