Help with Error Message please... [RESOLVED]

Talk about foreign keys

Moderators: ne_moj, zewa, vadimako, ne_moj, zewa, vadimako

daviddelmonte
Master
Master
Posts: 159
Joined: Feb 23rd, '10, 15:06

Help with Error Message please... [RESOLVED]

Postby daviddelmonte » Jun 5th, '10, 18:49

I am getting a ton of these messages. This is when I try to add a record, and the errors are where I'm trying to display a name and image, from a different table. I do not get the error in Display Mode or Edit Mode, however, nor do I get to see the name and image. I do see the name and image in the main section of the page..

Notice: Undefined variable: kFieldValue in /home1/beatric2/public_html/db/datagrid/classes/datagrid.class.php on line 5564

My code for the page is this:


Code: Select all


<?php

 
## +---------------------------------------------------------------------------+
## | 1. Creating & Calling:                                                    |
## +---------------------------------------------------------------------------+

##  *** define a relative (virtual) path to datagrid.class.php file
##  *** (relatively to the current file)
##  *** RELATIVE PATH ONLY ***     

define ("DATAGRID_DIR", "../datagrid/");                     /* Ex.: "datagrid/" */
define ("PEAR_DIR", "../datagrid/pear/");                    /* Ex.: "datagrid/pear/" */

require_once(DATAGRID_DIR.'classes/datagrid.class.php');
require_once(PEAR_DIR.'PEAR.php');
require_once(PEAR_DIR.'DB.php');

// includes database connection parameters
include_once(DATAGRID_DIR.'functions/config.inc.php');

   
ob_start();
$act = isset($_GET['act']) ? $_GET['act'] : "";

$neg = isset($_GET['negative_serial_no']) ? $_GET['negative_serial_no'] : "";
$master_p = isset($_GET['master_p']) ? $_GET['master_p'] : "";
$master_page_size = isset($_GET['master_page_size']) ? $_GET['master_page_size'] : "";


$db_conn = DB::factory('mysql');  /* don't forget to change on appropriate db type */
$result_conn = $db_conn->connect(DB::parseDSN('mysql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));

if(DB::isError($result_conn)){ die($result_conn->getDebugInfo()); }
     
## MYSQL CALL *** put a primary key on the first place         

if ($neg == "") {
$sql=" SELECT negatives.print_title,
negatives.image_thumb,
prints.print_key,
prints.negative_serial_no,
prints.edition_serial_no,
prints.print_serial_no,
prints.image_size,
prints.image_width,
prints.image_height,
prints.status,
prints.studio_location,
editions.edition_size,
editions.euro_list_price,
editions.dollar_list_price
FROM negatives INNER JOIN editions ON negatives.negative_serial_no = editions.negative_serial_no
INNER JOIN prints ON editions.negative_serial_no = prints.negative_serial_no AND editions.edition_serial_no = prints.edition_serial_no";
}
else
{
$sql=" SELECT negatives.print_title,
negatives.image_thumb,
prints.print_key,
prints.negative_serial_no,
prints.edition_serial_no,
prints.print_serial_no,
prints.image_size,
prints.image_width,
prints.image_height,
prints.status,
prints.studio_location,
editions.edition_size,
editions.euro_list_price,
editions.dollar_list_price
FROM negatives INNER JOIN editions ON negatives.negative_serial_no = editions.negative_serial_no
INNER JOIN prints ON editions.negative_serial_no = prints.negative_serial_no AND editions.edition_serial_no = prints.edition_serial_no
WHERE prints.negative_serial_no = ".(int)$neg;
}







   
##  *** set encoding and collation (default: utf8/utf8_unicode_ci)
/// $dg_encoding = "utf8";
/// $dg_collation = "utf8_unicode_ci";
/// $dgrid->SetEncoding($dg_encoding, $dg_collation);

##  *** set needed options and create a new class instance
$debug_mode = true;        /* display SQL statements while processing */   
$messaging = true;          /* display system messages on a screen */
$unique_prefix = "pr_";    /* prevent overlays - must be started with a letter */
$dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);

##  *** set data source with needed options
$default_order_field = "negatives.print_title";
$default_order_type = "ASC";
$dgrid->DataSource($db_conn, $sql, $default_order_field, $default_order_type);


## +---------------------------------------------------------------------------+
## | 2. General Settings:                                                      |
## +---------------------------------------------------------------------------+


##  *** set layouts: "0" - tabular(horizontal) - default, "1" - columnar(vertical), "2" - customized
$layouts = array("view"=>"0", "edit"=>"1", "details"=>"1", "filter"=>"2");
$dgrid->SetLayouts($layouts);


##  *** allow multirow operations
$multirow_option = true;
$dgrid->AllowMultirowOperations($multirow_option);

$multirow_operations = array(
    "edit"  => array("view"=>true),
    "delete"  => array("view"=>true),
    "details" => array("view"=>true),
);
$dgrid->SetMultirowOperations($multirow_operations); 

// SET BUTTONS

##  *** set modes for operations ("type" => "link|button|image")
##  *** "view" - view mode | "edit" - add/edit/details modes
##  *** "byFieldValue"=>"fieldName" - make the field to be a link to edit mode page
$modes = array(
"add"     =>array("view"=> true, "edit"=>true, "type"=>"button", "show_add_button"=>"outside"),
"edit"     =>array("view"=> true, "edit"=>true,  "type"=>"button", "byFieldValue"=>""),
"cancel"  =>array("view"=> false, "edit"=>true,  "type"=>"button"),
"details" =>array("view"=> true, "edit"=>false, "type"=>"button"),
"delete"  =>array("view"=> false, "edit"=>true,  "type"=>"button")
);

$dgrid->SetModes($modes);


// SET CSS

##  *** set CSS class for datagrid
##  *** "default" or "blue" or "gray" or "green" or "pink" or your own css file
$css_class = "x-blue";
$dgrid->SetCssClass($css_class);

##  *** set variables that used to get access to the page (like: my_page.php?act=34&id=56 etc.)
/// $http_get_vars = array("act", "id");
/// $dgrid->SetHttpGetVars($http_get_vars);

##  *** set other datagrid/s unique prefixes (if you use few datagrids on one page)

##  *** format (in which mode to allow processing of another datagrids)

##  *** array("unique_prefix"=>array("view"=>true|false, "edit"=>true|false, "details"=>true|false));
/// $anotherDatagrids = array("abcd_"=>array("view"=>true, "edit"=>true, "details"=>true));
/// $dgrid->SetAnotherDatagrids($anotherDatagrids); 

// SET CAPTION

##  *** set DataGrid caption
$dg_caption =  "<h2 class='sTitle'><br />" .  "Prints" . "</h2>";
//$dg_caption = "<br />" . "<h2>" . "Prints". "</h2>";
$dgrid->SetCaption($dg_caption);


## +---------------------------------------------------------------------------+
## | 3. Printing & Exporting Settings:                                         |
## +---------------------------------------------------------------------------+

##  *** set printing option: true(default) or false
$printing_option = true;
$dgrid->AllowPrinting($printing_option);

##  *** set exporting option: true(default) or false and relative (virtual) path
##  *** to export directory (relatively to datagrid.class.php file).
##  *** Ex.: "" - if we use current datagrid folder

$exporting_option = true;
$exporting_directory = "";               

$dgrid->AllowExporting($exporting_option, $exporting_directory);

$exporting_types = array("excel"=>"true", "pdf"=>"true", "xml"=>"true");

$dgrid->AllowExportingTypes($exporting_types);


## +---------------------------------------------------------------------------+
## | 4. Sorting & Paging Settings:                                             |
## +---------------------------------------------------------------------------+


##  *** set sorting option: true(default) or false
$sorting_option = true;
$dgrid->AllowSorting($sorting_option);               

##  *** set paging option: true(default) or false
$paging_option = true;
$rows_numeration = false;
$numeration_sign = "N #";       
$dgrid->AllowPaging($paging_option, $rows_numeration, $numeration_sign);

##  *** set paging settings
$bottom_paging = array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
$top_paging = array();
$pages_array = array("5"=>"5", "7"=>"7", "10"=>"10", "15"=>"15");
$default_page_size = 7;

##  *** set paging text
$paging_text = array("first"=>" first ", "previous"=>" previous ", "next"=>" next ", "last"=>" last ");

$dgrid->SetPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size, $paging_text);


## +---------------------------------------------------------------------------+
## | 5. Filter Settings:                                                       |
## +---------------------------------------------------------------------------+

##  *** set filtering option: true or false(default)
$filtering_option = true;
$show_search_type = true;
$dgrid->AllowFiltering($filtering_option, $show_search_type);

##  *** set additional filtering settings

##  *** tips: use "," (comma) if you want to make search by some words, for ex.: hello, bye, hi

// THIS BECOMES THE MAJOR SEARCH CRITERIA

$filtering_fields = array(
"Title" => array(
"type"=>"dropdownlist", 
"table"=>"negatives",
"source"=>"self",
"field"=>"print_title",
"operator"=>true, 
"case_sensitive"=>"false",
"comparison_type"=>"string",
"width"=>"150",
"on_js_event"=>"")
);


$dgrid->SetFieldsFiltering($filtering_fields);
 
     
## +---------------------------------------------------------------------------+
## | 6. View Mode Settings:                                                    |
## +---------------------------------------------------------------------------+
##  *** set view mode table properties

$vm_table_properties = array("width"=>"90%");
$dgrid->SetViewModeTableProperties($vm_table_properties); 

##  *** set columns in view mode

$vm_columns = array(

"print_key" =>array(
"header"=>"Key",
"visible"=>"false",
"type"=>"label"),


"print_title" =>array(
"header"=>"Title",         
"type"=>"textbox", 
"width"=>"210px"),


"image_thumb" => array(
"header"=>"Image",
"table"=>"negatives",
"type"=>"image", 
"align"=>"center",
"width"=>"50px",
"wrap"=>"nowrap",   
"visible"=>"true",
"on_js_event"=>"",
"target_path"=>"../datagrid/uploads/",
"default"=>"default_image.ext",
"image_width"=>"50px",
"image_height"=>"50px",
"magnify"=>"true",
"magnify_type"=>"magnifier",
"magnify_power"=>"3"),


/*
"negative_serial_no" =>array(
"header"=>"Negative Serial No", 
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"20",
"case"=>"normal"),

"edition_serial_no" =>array(
"header"=>"Edition Serial No", 
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"20",
"case"=>"normal"),

*/

"print_serial_no" =>array(
"header"=>"Print Number", 
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"20",
"case"=>"normal"),

"image_size" =>array(
"header"=>"Image Size", 
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"20",
"case"=>"normal"),

"status" =>array(
"header"=>"Status", 
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"30",
"case"=>"normal"),

/*
"printNumber"=> array(
"header"=>"Print Number",
"field_name"=>"CONCAT(print_serial_no' of ' edition_size) as printNumber",
"readonly"=>"true",
"maxlength"=>"-1",
"default"=>"",
"unique"=>"false", 
"visible"=>"true",
"on_js_event"=>"" ),
*/

"dollar_list_price" =>array(
"header"=>"Dollar List Price",     
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"30",
"case"=>"normal"),

"euro_list_price" =>array(
"header"=>"Euro List Price",     
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"30",
"case"=>"normal"),

"edition.edition_size" =>array(
"header"=>"Edition Size",     
"type"=>"label",
"align"=>"center", 
"wrap"=>"nowrap",
"text_length"=>"30",
"case"=>"normal")


);

$dgrid->SetColumnsInViewMode($vm_columns);



##  *** set auto-generated columns in view mode
//  $auto_column_in_view_mode = false;
//  $dgrid->SetAutoColumnsInViewMode($auto_column_in_view_mode);
   
   
## +---------------------------------------------------------------------------+
## | 7. Add/Edit/Details Mode Settings:                                        |
## +---------------------------------------------------------------------------+
##  *** set add/edit mode table properties

$em_table_properties = array("width"=>"75%");

$dgrid->SetEditModeTableProperties($em_table_properties);

##  *** set details mode table properties

$dm_table_properties = array("width"=>"60%");

$dgrid->SetDetailsModeTableProperties($dm_table_properties);

##  ***  set settings for add/edit/details modes

$table_name  = "prints";
$primary_key = "print_serial_no";
$condition   = "";

$dgrid->SetTableEdit($table_name, $primary_key, $condition);

##  *** set columns in edit mode
##  *** first letter:   r - required,
##  ***                  s - simple (not required)

##  *** second letter:  t - text(including datetime),
##  ***               n - numeric,
##  ***               a - alphanumeric,
##  ***               e - email,
##  ***               f - float,
##  ***               y - any,
##  ***               l - login name,
##  ***               z - zipcode,
##  ***               p - password,
##  ***               i - integer,
##  ***               v - verified

##  *** third letter (optional):

##  for numbers:       s - signed,
##  ***               u - unsigned,
##  ***               p - positive,
##  ***               n - negative

##  for strings:       u - upper, 
##  ***               l - lower,   
##  ***               n - normal,   
##  ***               y - any

##  *** Ex.: "on_js_event"=>"onclick='alert(\"Yes!!!\");'"
##  *** Ex.: type = textbox|textarea|label|date(yyyy-mm-dd)|datedmy(dd-mm-yyyy)|datetime(yyyy-mm-dd hh:mm:ss)|datetimedmy(dd-mm-yyyy hh:mm:ss)|image|password|enum|print|checkbox

##  *** make sure your WYSIWYG dir has 755 permissions
       

/// $fill_from_array = array("0"=>"No", "1"=>"Yes", "2"=>"Don't know", "3"=>"Maybe"); /* as "value"=>"option" */


//PRE-FILL ARRAYS - MAYBE THESE CAN BE MADE INTO TABLES?

$fill_from_array_tripod = array(
"yes"=>"yes",
"no"=>"no");

$fill_from_array_shootYear = array(
"2012"=>"2012",
"2011"=>"2011",
"2010"=>"2010",
"2009"=>"2009",
"2008"=>"2008",
"2007"=>"2007",
"2006"=>"2006",
"2005"=>"2005",
"2004"=>"2004",
"2003"=>"2003",
"2002"=>"2002",
"2001"=>"2001",
"2000"=>"2000",
"1999"=>"1999",
"1998"=>"1998");

$fill_from_array_shootMonth = array(
"January"=>"January",
"February"=>"February",
"March"=>"March",
"April"=>"April",
"May"=>"May",
"June"=>"June",
"July"=>"July",
"August"=>"August",
"September"=>"September",
"October"=>"October",
"November"=>"November",
"December"=>"December");

$fill_from_array_shootDay = array(
"1"=>"1",
"2"=>"2",
"3"=>"3",
"4"=>"4",
"5"=>"5",
"6"=>"6",
"7"=>"7",
"8"=>"8",
"9"=>"9",
"10"=>"10",
"11"=>"11",
"12"=>"12",
"13"=>"13",
"14"=>"14",
"15"=>"15",
"16"=>"16",
"17"=>"17",
"18"=>"18",
"19"=>"19",
"20"=>"20",
"21"=>"21",
"22"=>"22",
"23"=>"23",
"24"=>"24",
"25"=>"25",
"26"=>"26",
"27"=>"27",
"28"=>"28",
"29"=>"29",
"30"=>"30",
"31"=>"31");


$fill_from_array_body = array(
"1"=>"1",
"2"=>"2");

$fill_from_array_lens = array(
"50mm"=>"50mm",
"80mm"=>"80mm",
"210mm"=>"210mm",
"Auto"=>"Auto",
"Other"=>"Other");


$fill_from_array_location = array(
"Skopelos"=>"Skopelos",
"Eperus"=>"Eperus",
"Kefalohia"=>"Kefalohia",
"Persogiani"=>"Persogiani",
"Other"=>"Other");

$fill_from_array_country = array(
"United States"=>"United States",
"Greece"=>"Greece",
"Albania"=>"Albania",
"France"=>"France",
"France"=>"France",
"United Kingdom"=>"United Kingdom",
"Other"=>"Other");

$fill_from_array_film = array(
"Kodak TriX"=>"Kodak TriX",
"Digital"=>"Digital",
"Other"=>"Other");
 

$fill_from_array_exp = array(
"1.8"=>"1.8",
"2"=>"2",
"2.8"=>"2.8",
"4"=>"4",
"5.6"=>"5.6",
"8"=>"8",
"11"=>"11",
"16"=>"16",
"22"=>"22",
"Auto"=>"Auto",
"Other"=>"Other");



$fill_from_array_filmspeed = array(
"2000"=>"2000",
"1000"=>"1000",
"500"=>"500",
"256"=>"256",
"128"=>"128",
"64"=>"64",
"32"=>"32",
"16"=>"16",
"8"=>"8",
"4"=>"4",
"2"=>"2",
"1"=>"1",
"M"=>"M",
"Auto"=>"Auto",
"Other"=>"Other");


$fill_from_array_filmISO = array(
"25"=>"25",
"50"=>"50",
"100"=>"100",
"200"=>"200",
"400"=>"400",
"800"=>"800",
"1000"=>"1000",
"1200"=>"1200",
"1500"=>"1500",
"Auto"=>"Auto",
"Other"=>"Other");



$fill_from_array_filter = array(
"none"=>"none",
"two"=>"two",
"three"=>"three",
"four"=>"four",
"five"=>"five",
"six"=>"six",
"seven"=>"seven",
"eight"=>"eight",
"nine"=>"nine",
"ten"=>"ten",
"Auto"=>"Auto",
"Other"=>"Other");



$fill_from_array_filmDeveloper = array(
"none"=>"none",
"two"=>"two",
"three"=>"three",
"four"=>"four",
"five"=>"five",
"six"=>"six",
"seven"=>"seven",
"eight"=>"eight",
"nine"=>"nine",
"ten"=>"ten",
"Lab"=>"Lab",
"Other"=>"Other");


$fill_from_array_fileYear = array(
"2012"=>"2012",
"2011"=>"2011",
"2010"=>"2010",
"2009"=>"2009",
"2008"=>"2008",
"2007"=>"2007",
"2006"=>"2006",
"2005"=>"2005",
"2004"=>"2004",
"2003"=>"2003",
"2002"=>"2002",
"2001"=>"2001",
"2000"=>"2000",
"1999"=>"1999",
"1998"=>"1998");
 

$fill_from_array_fileNumber = array(
"1"=>"1",
"2"=>"2",
"3"=>"3",
"4"=>"4",
"5"=>"5",
"6"=>"6",
"7"=>"7",
"8"=>"8",
"9"=>"9",
"10"=>"10",
"11"=>"11",
"12"=>"12");

$fill_from_array_paper = array(
"Digital Pigment"=>"Digital Pigment",
"Ilford Polycontrast Fiber"=>"Ilford Polycontrast Fiber",
"Kodak Professional Polycontrast Fiber"=>"Kodak Professional Polycontrast Fiber",
"Oriental Seagull Polycontrast Fiber"=>"Oriental Seagull Polycontrast Fiber",
"Other"=>"Other");

$fill_from_array_status = array(
"Studio Inventory"=>"Studio Inventory",
"Consigned"=>"Consigned",
"Gift"=>"Gift",
"Personal Use"=>"Personal Use",
"Sold"=>"Sold",
"Other"=>"Other");

$fill_from_array_frame = array(
"unframed"=>"unframed",
"EOS Wood"=>"EOS Wood",
"Black Metal"=>"Black Metal",
"Face-Mount Plexi"=>"Face-Mount Plexi",
"White Apex"=>"White Apex",
"Other"=>"Other");

$fill_from_array_frameUnit = array(
"inches"=>"inches",
"cm"=>"cm",
"Other"=>"Other");

$fill_from_array_glassType = array(
"glass"=>"glass",
"plexi"=>"plexi",
"Face-Mount Plexi"=>"Face-Mount Plexi",
"Other"=>"Other");

$fill_from_array_studio = array(
"Washington"=>"Washington",
"Skopelos"=>"Skopelos",
"Other"=>"Other");   
 

//END OF PREFILL ARRAYS

$em_columns = array(

"print_key" =>array(
"header"=>"Key",
"type"=>"label",
"align"=>"left",   
"visible"=>"false",   
),

"delimiter_1"    =>array(   
"inner_html"=>"<h3 class='shead'><br />• Photograph Name</h3><br />"), 

// PHOTOGRAPH TITLE

"print_title" =>array(
"header"=>"Photograph Title",
"type"=>"label",
"table"=>"negatives",     
"width"=>"300px",
"readonly"=>"true", 
"visible"=>"true",
"on_js_event"=>""),

// IMAGE THUMBNAIL

"image_thumb" =>array(
"header"=>"Thumbnail",
"type"=>"label",       
"width"=>"120px",
"readonly"=>"true",
"visible"=>"true",
"on_js_event"=>"onclick='alert(\"Cannot be changed here.. You can change it in the Negatives section\");'",
"target_path"=>"uploads/", 
"image_width"=>"120px",
"image_height"=>"120px",
"magnify"=>"true",
"magnify_type"=>"lightbox"
),


// NEGATIVE SERIAL NUMBER

"negative_serial_no" =>array(
"header"=>"Negative Serial No.",
"type"=>"label",   
"req_type"=>"rt",
"width"=>"100px",
"title"=>"",
"readonly"=>"true",
"maxlength"=>"-1",
"default"=>"",
"unique"=>true,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>"onclick='alert(\"Cannot be changed here.. You can change it in the Negatives section\");'"),

// EDITION SERIAL NUMBER

"edition_serial_no" =>array(
"header"=>"Edition Serial No.",
"type"=>"label",   
"req_type"=>"rt",
"width"=>"100px",
"title"=>"",
"readonly"=>"true",
"maxlength"=>"-1",
"default"=>"",
"unique"=>true,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>"onclick='alert(\"Cannot be changed here.. You can change it in the Editions section\");'"),


// PRINT SERIAL NUMBER

"print_serial_no" =>array(
"header"=>"Print Serial No.",
"type"=>"textbox",   
"req_type"=>"rt",
"width"=>"100px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>false,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>"onclick='alert(\"This is the Print Number, eg 5 of xxx.\");'"),

// DATE PRINTED

"date_printed" =>array(
"header"=>"Date Printed",
"type"=>"datetime",   
"req_type"=>"st",
"width"=>"187px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>"false",
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>"",
"calendar_type"=>"floating"),

"delimiter_2"    =>array(   
"inner_html"=>"<h3 class='shead'><br />• Dimensions</h3><br /><h4 class='shead2'></h4><br />"), 



// PAPER TYPE

"paper_type" =>array(
"source"=>$fill_from_array_paper,
"header"=>"Paper Type",
"req_type"=>"st",
"unique"=>false,
"type"=>"enum",
"width"=>"200px",
"operator"=>true,
"default"=>"" ),

// STATUS

"status" =>array(
"source"=>$fill_from_array_status,
"req_type"=>"st",
"header"=>"Status",
"unique"=>false,
"type"=>"enum",
"width"=>"200px",
"operator"=>true,
"default"=>"" ),

// DATE OF DISPOSITION

"date_of_disposition" =>array(
"header"=>"Date of Disposition",
"type"=>"datetime",   
"req_type"=>"st",
"width"=>"187px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>"false",
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>"",
"calendar_type"=>"floating"),

// IMAGE SIZE

"image_size" =>array(
"header"=>"Image Size",
"type"=>"textbox",   
"req_type"=>"st",
"width"=>"100px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>true,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>""),

// IMAGE HEIGHT

"image_height" =>array(
"header"=>"Image Height",
"type"=>"textbox",   
"req_type"=>"st",
"width"=>"100px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>true,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>""),


// IMAGE WIDTH

"image_width" =>array(
"header"=>"Image Width",
"type"=>"textbox",   
"req_type"=>"st",
"width"=>"100px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>true,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>""),


// FRAME TYPE

"frame_type" =>array(
"source"=>$fill_from_array_frame,
"req_type"=>"st",
"unique"=>false,
"type"=>"enum",
"width"=>"50px",
"operator"=>true,
"default"=>"" ),

// FRAME HEIGHT

"frame_height" =>array(
"header"=>"Frame Height",
"type"=>"textbox",   
"req_type"=>"st",
"width"=>"100px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>true,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>""),

// FRAME WIDTH

"frame_width" =>array(
"header"=>"Frame Width",
"type"=>"textbox",   
"req_type"=>"st",
"width"=>"100px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"-1",
"default"=>"",
"unique"=>true,
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>""),

// FRAME SIZE UNITS

"frame_size_units" =>array(
"source"=>$fill_from_array_frameUnit,
"header"=>"Units",
"req_type"=>"st",
"unique"=>false,
"type"=>"enum",
"width"=>"100px",
"operator"=>true,
"default"=>"" ),

// GLASS TYPE

"glass-type" =>array(
"source"=>$fill_from_array_glassType,
"req_type"=>"st",
"unique"=>false,
"type"=>"enum",
"width"=>"100px",
"operator"=>true,
"default"=>"" ),


"delimiter_3"    =>array(   
"inner_html"=>"<h3 class='shead'><br />• Sale and Location Information</h3><br /><h4 class='shead2'></h4><br />"), 


// STUDIO LOCATION

"studio_location" =>array(
"source"=>$fill_from_array_studio,
"header"=>"Studio Location",
"req_type"=>"st",
"unique"=>false,
"type"=>"enum",
"width"=>"100px",
"operator"=>true,
"default"=>"" ),

// CUSTOMER INFO - dropdown from Customers..

"fkey2" =>array(
"header"=>"Customer Name",
"type"=>"foreign_key",       
"req_type"=>"st",
"width"=>"300px",
"title"=>"",
"readonly"=>"false",
"default"=>"",
"unique"=>"false",
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>"",         
"view_type"=>"dropdownlist"),


//NOTES
"delimiter_4"    =>array(
"inner_html"=>"<h3 class='shead'><br />• Notes: </h3><br />"),
//NOTES

"notes"  =>array(
"header"=>" ",
"type"=>"textarea",   
"req_type"=>"st",
"width"=>"400px",
"title"=>"",
"readonly"=>"false",
"maxlength"=>"1024",
"default"=>"",
"unique"=>"false",
"unique_condition"=>"",
"visible"=>"true",
"on_js_event"=>"",
"edit_type"=>"wysiwyg",
"resizable"=>"true",
"rows"=>"15",
"cols"=>"50"),


"delimiter_5"    =>array(
"inner_html"=>"<br />"),
);




$dgrid->SetColumnsInEditMode($em_columns);

##  *** set auto-generated columns in edit mode
//  $auto_column_in_edit_mode = false;
//  $dgrid->SetAutoColumnsInEditMode($auto_column_in_edit_mode);
##  *** set foreign keys for add/edit/details modes (if there are linked tables)
##  *** Ex.: "field_name"=>"CONCAT(field1,','field2) as field3"
##  *** Ex.: "condition"=>"TableName_1.FieldName > 'a' AND TableName_1.FieldName < 'c'"
##  *** Ex.: "on_js_event"=>"onclick='alert(\"Yes!!!\");'"
     
$foreign_keys = array(
"print_key"=>array(
"field_key"=>"negative_serial_no",
"field_name"=>"negative_serial_no",
"view_type"=>"label",
"radiobuttons_alignment"=>"horizontal|vertical",
"condition"=>"",
"on_js_event"=>""),

"print_title"=>array(
"table"=>"negatives",
"field_key"=>"negative_serial_no",
"field_name"=>"print_title",
"view_type"=>"label",
"on_js_event"=>""),

"image_thumb"=>array(
"table"=>"negatives",
"field_key"=>"negative_serial_no",
"field_name"=>"image_thumb",
"view_type"=>"image",
"on_js_event"=>"")




 /*
"printNumber"=> array(
"title"=>"Print Number",
"field_name"=>"CONCAT(print_serial_no' of ' edition_size) as printNumber",
"readonly"=>"true",
"maxlength"=>"-1",
"default"=>"",
"unique"=>"false", 
"visible"=>"true",
"on_js_event"=>"" ),
*/


);

$dgrid->SetForeignKeysEdit($foreign_keys);

//field_name"=>"CONCAT(field1,','field2) as field3
//CONCAT(print_serial_no' of ' edition_size) as printNumber;

## +---------------------------------------------------------------------------+
## | 8. Bind the DataGrid:                                                     |
## +---------------------------------------------------------------------------+
##  *** bind the DataGrid and draw it on the screen
## call of this method between HTML <HEAD> tags

//$dgrid->WriteCssClass();

$dgrid->Bind();
       
ob_end_flush();

################################################################################   

?>

</body>
</html>


administrator
Site Admin
Site Admin
Posts: 5992
Joined: Jan 7th, '09, 23:18
Contact:

Re: Help with Error Message please... [RESOLVED]

Postby administrator » Jun 8th, '10, 13:11

RESOLVED how?

daviddelmonte
Master
Master
Posts: 159
Joined: Feb 23rd, '10, 15:06

Re: Help with Error Message please... [RESOLVED]

Postby daviddelmonte » Jun 8th, '10, 14:33

I worked on a lot of issues over the weekend..

I think I resolved it as follows:

1. SQL call to foreign table

Code: Select all

$sql = "SELECT
collections.collection_serial_no,
collections.collection_name,
FROM collections";


2. Field Definition

Code: Select all

// COLLECTION   
         
"collection_serial_no" =>array(
"header"=>"Collection",
"type"=>"foreign_key",       
"req_type"=>"ri",
"width"=>"210px",
"title"=>"",
"readonly"=>"false",
"default"=>"",
"unique"=>"false",
"unique_condition"=>"",
"visible"=>"true",
),



3. Foreign Key definition

Code: Select all

$foreign_keys = array(
"collection_serial_no"=>array(
"table"=>"collections",
"field_key"=>"collection_serial_no",
"field_name"=>"collection_name",
"view_type"=>"dropdownlist",
 "condition"=>"",
"order_by_field"=>"",
"order_type"=>"ASC",
"on_js_event"=>"")


);



Return to “Field type: "foreign key"”