9 Replies Latest reply on Jan 30, 2009 1:59 PM by (jeremy_graziano)

    No Primary Key Column was set. (UPD_NO_PK_SET)

      I'm trying to build an update record page that gets the primary key value passed from a dynamic edit selection. dynamic list is great..opens up to the update record page great...values filled in including the primary key...i can see the primary key value listed in the URL...but then i hit submit and I get:

      No Primary Key Column was set. (UPD_NO_PK_SET)

      I have seen this error posted a lot, but no concise solution..been working on this for days...Please please help..! i'm desperate!
        • 1. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
          dizmarkie
          do you need to have your primary key in your form?
          Out of pure lack of needing it as most of my primary keys are auto-increment ID's I've never ran into this issue.

          If you don't need to update the key I would use the "manage dynamic form" wizard to remove the key field from the form and try again.
          • 2. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
            Level 1
            I dont need the primary key in my form at all. To clarify:

            I'm using the dynamic list wizard for one page..pulling values from 2 tables and displaying the results. The dynamic list wizard forces one to choose a primary key. i get a nice list.

            i then create an update page. I use the update record wizard....and this again requires you to choose a primary field...which i do ...and it shows in the url bar...

            When i click edit on dynamic list page..takes me to update page...the values are filled in and i change one item...i have removed the primary id's from the list of fields...so that can't be changed or viewed...still get the no primary key column was set!

            I have tried the dynamic form wizard, but Nothing displays..none of the values seem to carry over from the dynamic list!

            Thank you so much for your time Kevin...happily reimburse you via pay pal if you'd be able to get me past this...or if you could take me thru a step by step process?

            Jeremy.
            • 3. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
              dizmarkie Level 1
              No need for re-imbursement. I've had my life saved here many times.

              OK.. soo...
              As far as I know the dynamic form wizard is meant to go hand in hand with the dynamic list component.

              I use it ALL the time and I love it, so much control and no need to have an update,add new and delete pages when the dynamic form can handle all these functions on one page. So I would try to get the dynamic form wizard going.

              lets (for now) assume your tables in your database are setup properly.

              1. create new page
              2. create a recordset (simple mode is fine and all fields are dine too)
              3. Start Dynamic List wizard.
              3a) Get data from: recordset
              3b) Choose recordset, your primary key column. (create a recordset if you haven't already by clicking the "add recordset button" right in the wizard.
              3c) Choose the detail page (the page that will have your dynamic form on it)
              3d) Choose which fields you would like to show. The dynamic list page is meant to be used as a "master" page between a master/detail relation ship between the itself and the dynamic form page. No need to show your ID field, just a few that you would like to have in this view.

              the rest of the options are not important for getting you pass your hurdle. feel free to go back and play though.

              OK.. so far so good.. once you finish this wizard it will dynamically start a new page for your detail page and place it in the same level as your dynamic list. If you open this page you will notice there is not much going on in the page, it simple creates a blank php page with no functionality.

              4. Start Dynamic form wizard
              4a) choose table (same table as dynamic list) and choose ID
              4b) Add all your fields you would like to be in your ADD, UPDATE form (no need to add the ID. you can use the + and - buttons to add and remove fields.

              The rest of the options are not critical at this point either.
              Save the page out and that should be it!

              If you have done all of this and still having issues. I would say I need to look at your files and database structure to inspect.

              And there are a lot of tutorials at http://www.interaktonline.com/Products/Bundles/MXKollection/Documentation/

              take a look at their online documentation.

              good luck
              • 4. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
                Level 1
                I follow that exactly but get the same problem BUT i do manange to get things to work if i delete a couple lines of code:

                // Load the KT_back class
                require_once('includes/nxt/KT_back.php');

                But I don't understand the impact of just removing this line of code...could you please advise if this is ok to just delete...or why this would be necessary?

                Again thank you for your help!

                much appreciated!
                • 5. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
                  dizmarkie Level 1
                  weird.
                  I certainly am not an expert by any means and just another novice out there trying to get by :)

                  But from what I think.. that include is not mandatory to work but it will take away functionality. When you hit the "cancel" button does your page go back to the dynamic list page? or even when you submit the form successfully? I think that is the purpose of that class.

                  Why dont you paste your code and i'll compare to one of my forms.
                  cheers
                  • 6. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
                    Günter Schenk Level 4
                    Folks,

                    the underlying function "KT_back" is basically an advanced implementation of PHP´s $_SERVER['HTTP_REFERER'] variable, means it will redirect to the page which has passed the URL variable "KT_back" to the form in question, and on top of this the $_SERVER['HTTP_REFERER'] variable is getting stored in a Session Variable.

                    ------
                    But from what I think.. that include is not mandatory to work but it will take away functionality
                    ------

                    this will indeed take away that functionality, because a Dynamic Form actually by default just points to the related file "includes/nxt/back.php" within each transaction´s "Trigger_Default_Redirect" parameter.

                    However, as it´s in theory (talking about the form´s "Trigger_Default_Redirect" parameters now) possible to define the relative path to the related Dynamic List rather than using the KT_back function, you might try doing this for all form transactions.

                    ------
                    When you hit the "cancel" button does your page go back to the dynamic list page?
                    ------

                    the cancel button uses a javascript onclick event which calls the function "UNI_navigateCancel" -- and this one utilizes ADDT´s PHP function "KT_back" as well.

                    As the purpose of cancelling the form submission appears to be the same (returning to the Dynamic List), I´m pretty sure that you could try with implemeting a simple javascript redirection as explained here: http://www.tizag.com/javascriptT/javascriptredirect.php

                    Cheers,
                    Günter Schenk
                    Adobe Community Expert, Dreamweaver
                    • 7. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
                      Level 1
                      Ok, I'm confused....with <br /> <br />// Load the KT_back class <br />require_once('includes/nxt/KT_back.php'); <br /> <br />removed all works great...the delete, the insert. When I do any of those desired functions, I do get back to the dynamic list page..however, I chose to edit say record 12 ..with only 10 showing per page so i'm on the second page...if i cancel..i jump back to record page one...Is that the functionality I'm losing? <br /> <br />hope you dont mind, but I am trying to post the code? <br /> <br />code for statuslist page: <br /> <br /><?php require_once('Connections/PatientDB.php'); ?> <br /><?php<br />// Load the common classes<br />require_once('includes/common/KT_common.php');<br /><br />// Load the required classes<br />require_once('includes/tfi/TFI.php');<br />require_once('includes/tso/TSO.php');<br />require_once('includes/nav/NAV.php');<br /><br />// Make unified connection variable<br />$conn_PatientDB = new KT_connection($PatientDB, $database_PatientDB);<br /><br />if (!function_exists("GetSQLValueString")) {<br />function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") <br />{<br />  if (PHP_VERSION < 6) {<br />    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;<br />  }<br /><br />  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);<br /><br />  switch ($theType) {<br />    case "text":<br />      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";<br />      break;    <br />    case "long":<br />    case "int":<br />      $theValue = ($theValue != "") ? intval($theValue) : "NULL";<br />      break;<br />    case "double":<br />      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";<br />      break;<br />    case "date":<br />      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";<br />      break;<br />    case "defined":<br />      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;<br />      break;<br />  }<br />  return $theValue;<br />}<br />}<br /><br />// Filter<br />$tfi_listRecordset1 = new TFI_TableFilter($conn_PatientDB, "tfi_listRecordset1");<br />$tfi_listRecordset1->addColumn("status", "STRING_TYPE", "status", "%");<br />$tfi_listRecordset1->Execute();<br /><br />// Sorter<br />$tso_listRecordset1 = new TSO_TableSorter("Recordset1", "tso_listRecordset1");<br />$tso_listRecordset1->addColumn("status");<br />$tso_listRecordset1->setDefault("status");<br />$tso_listRecordset1->Execute();<br /><br />// Navigation<br />$nav_listRecordset1 = new NAV_Regular("nav_listRecordset1", "Recordset1", "", $_SERVER['PHP_SELF'], 10);<br /><br />//NeXTenesio3 Special List Recordset<br />$maxRows_Recordset1 = $_SESSION['max_rows_nav_listRecordset1'];<br />$pageNum_Recordset1 = 0;<br />if (isset($_GET['pageNum_Recordset1'])) {<br />  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];<br />}<br />$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;<br /><br />// Defining List Recordset variable<br />$NXTFilter_Recordset1 = "1=1";<br />if (isset($_SESSION['filter_tfi_listRecordset1'])) {<br />  $NXTFilter_Recordset1 = $_SESSION['filter_tfi_listRecordset1'];<br />}<br />// Defining List Recordset variable<br />$NXTSort_Recordset1 = "status";<br />if (isset($_SESSION['sorter_tso_listRecordset1'])) {<br />  $NXTSort_Recordset1 = $_SESSION['sorter_tso_listRecordset1'];<br />}<br />mysql_select_db($database_PatientDB, $PatientDB);<br /><br />$query_Recordset1 = "SELECT * FROM status_listEG WHERE  {$NXTFilter_Recordset1}  ORDER BY  {$NXTSort_Recordset1} ";<br />$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);<br />$Recordset1 = mysql_query($query_limit_Recordset1, $PatientDB) or die(mysql_error());<br />$row_Recordset1 = mysql_fetch_assoc($Recordset1);<br /><br />if (isset($_GET['totalRows_Recordset1'])) {<br />  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];<br />} else {<br />  $all_Recordset1 = mysql_query($query_Recordset1);<br />  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);<br />}<br />$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;<br />//End NeXTenesio3 Special List Recordset<br /><br />$nav_listRecordset1->checkBoundries();<br />?> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <script src="includes/common/js/base.js" type="text/javascript"></script> <br /> <script src="includes/common/js/utility.js" type="text/javascript"></script> <br /> <script src="includes/skins/style.js" type="text/javascript"></script> <br /> <script src="includes/nxt/scripts/list.js" type="text/javascript"></script> <br /> <script src="includes/nxt/scripts/list.js.php" type="text/javascript"></script> <br /> <script type="text/javascript"></script>$NXT_LIST_SETTINGS = { <br /> duplicate_buttons: true, <br /> duplicate_navigation: true, <br /> row_effects: true, <br /> show_as_buttons: true, <br /> record_counter: true <br />} <br /> <br /> /* Dynamic List row settings */ <br /> .KT_col_status {width:140px; overflow:hidden;} <br /> <br /> <br /> <br /> <br /> <div class="KT_tng" id="listRecordset1"> <br /> <h1>status_listEG <br /> <?php<br />  $nav_listRecordset1->Prepare();<br />  require("includes/nav/NAV_Text_Statistics.inc.php");<br />?> <br /></h1> <br /> <div class="KT_tnglist"> <br /> <form action="%3C?php%20echo%20KT_escapeAttribute(KT_getFullUri());%20?%3E" method="post" id="form1"> <br /> <div class="KT_options"> <a href="%3C?php%20echo%20$nav_listRecordset1-%3EgetShowAllLink();%20?%3E"><?php echo NXT_getResource("Show"); ?> <br /> <?php <br />  // Show IF Conditional region1<br />  if (@$_GET['show_all_nav_listRecordset1'] == 1) {<br />?> <br /> <?php echo $_SESSION['default_max_rows_nav_listRecordset1']; ?> <br /> <?php <br />  // else Conditional region1<br />  } else { ?> <br /> <?php echo NXT_getResource("all"); ?> <br /> <?php } <br />  // endif Conditional region1<br />?> <br /> <?php echo NXT_getResource("records"); ?></a> &#160; <br /> &#160; <br /> <?php <br />  // Show IF Conditional region2<br />  if (@$_SESSION['has_filter_tfi_listRecordset1'] == 1) {<br />?> <br /> <a href="%3C?php%20echo%20$tfi_listRecordset1-%3EgetResetFilterLink();%20?%3E"> <?php echo NXT_getResource("Reset filter"); ?> </a> <br /> <?php <br />  // else Conditional region2<br />  } else { ?> <br /> <a href="%3C?php%20echo%20$tfi_listRecordset1-%3EgetShowFilterLink();%20?%3E"> <?php echo NXT_getResource("Show filter"); ?> </a> <br /> <?php } <br />  // endif Conditional region2<br />?> <br /></div> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <table cellpadding="2" cellspacing="0" class="KT_tngtable"> <thead> <tr class="KT_row_order"> <th> <input type="checkbox" name="KT_selAll" id="KT_selAll" /> <br /></th> <th id="status" class="KT_sorter KT_col_status &lt;?php echo $tso_listRecordset1-&gt;getSortIcon('status'); ?&gt;"> <a href="%3C?php%20echo%20$tso_listRecordset1-%3EgetSortLink('status');%20?%3E">Status</a> </th> <th>&#160;</th> </tr><?php <br />  // Show IF Conditional region3<br />  if (@$_SESSION['has_filter_tfi_listRecordset1'] == 1) {<br />?> <tr class="KT_row_filter"> <td>&#160;</td> <td> <input type="text" name="tfi_listRecordset1_status" id="tfi_listRecordset1_status" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listRecordset1_status']); ?>" size="20" maxlength="20" /> </td> <td> <input type="submit" name="tfi_listRecordset1" value="<?php echo NXT_getResource(" />" /&gt;</td> </tr><?php } <br />  // endif Conditional region3<br />?> </thead> <tbody> <?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?> <tr> <td colspan="3"> <?php echo NXT_getResource("The table is empty or the filter you've selected is too restrictive."); ?> </td> </tr><?php } // Show if recordset empty ?><?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?><?php do { ?> <tr class="<?php echo @$cnt1++%2==0 ? "></tr> </tbody> </table></form></div></div>
                      • 8. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
                        Günter Schenk Level 4
                        Hi Jeremy,

                        -------
                        however, I chose to edit say record 12 ..with only 10 showing per page so i'm on the second page...if i cancel..i jump back to record page one...Is that the functionality I'm losing?
                        ------

                        for whatever reason ADDT always jumps to page 1 of a Dynamic List after an insert/update/delete transaction, so that´s not a loss of functionality.

                        Something else: when providing page code including html tags etc, please don´t post it to these forums, because it´s going to be messed up -- in this case better upload the code as .txt file on your server and give us a link to this file.

                        Cheers,
                        Günter Schenk
                        Adobe Community Expert, Dreamweaver
                        • 9. Re: No Primary Key Column was set. (UPD_NO_PK_SET)
                          Level 1
                          Thank you both Kevin and Gunter. Since I can't figure out or see any lose of functionality just pulling that one line of code, I'm going to just continue with this solution...maybe I'll see what is lost down the road, but for now.......

                          thank you!

                          Jeremy.