Jump to content

gmark

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by gmark

  1. Is there a summary or overview or comparison of the SDEs anywhere that folks would recommend? Is a "framework" the same as an SDE? Mark
  2. Some questions regarding SDEs -- What are the favorites and why? (+/-'s) Is the cost of Zend Studio justified? Which one(s) is best documented? Useful and/or differentiating features? Thanks!!
  3. I also need to move the drop-down option list to the right, abutted against the other list at the end of the line. CALLING FUNCTION: /** * Constructor of the Note class. */ function __construct($company_id = -1, $user_id = -1) { $this->company_id = ($company_id == -1) ? (int) $_SESSION['USER']['COMPANYID'] : (int) $company_id; $this->user_id = ($user_id == -1) ? (int) $_SESSION['USER']['USERID'] : (int) $user_id; if(isset($_POST['RecordsPerPage'])) { /* Set the number of Recors shows in the page. */ $this->pageRecords = $_POST['RecordsPerPage']; } else { $this->pageRecords = 5; } FORM CODE: <script type="text/javascript" src="http://localhost/test.js"></script> <div id="noteDiv" class='clsSucc' width="100%" align="right" style="display:none;"> </div> <form id="Contactpp" method="post"> <input type="hidden" name="action" value="contact" /> <input type="hidden" name="contactId" value="176" /> <select onchange="java script:form.submit();" action="__construct($company_id = -1, $user_id = -1)?RecordsPerPage=5" name="Re cordsPerPage" id="RecordsPerPage" > {html_options output=$module->records_per_page values=$module->records_per_page selected=$module->search.records_per_page} <option value=5>5</option> <option value=10>10</option> <option value=25>25</option> <option value=50>50</option> <option value=100>100</option> </select> </form> Records per page {include file="snippet_note_list.tpl"} </div>
  4. The option chosen in my form disappears -- both the initial default and the option chosen are no longer visible after the value is chosen. I use an ajax call to refresh the page, if that's any clue. Perhaps there's a way I can save the value and write to the drop-down field or something? Mark
  5. Is there a way to have the values that are DISPLAYED by a FORM actually result in another set of VALUES actually being returned? For example, having arbitrary values displayed to the user to generate another set of values? Thanks!
  6. Hi - I've got a program to allow the user to upload a file and then select, for each column of an existing table, the column from the new source table to insert. However, what I need to do is do the insert using the actual names, but show the user a drop-down menu of the LABELS they've chosen for each of these real, target columns. Is there a "clean" or "tricky" way of doing this? The code to do the inserts works by just reading the translation table that has two columns -- source column fieldname and target column (in the existing table) fieldnames (both real fieldnames, of course). Here's what I've got: <form action="index.php" method="post"> <input type="hidden" id="unique" name="unique" value="<?php echo $unique_nm; ?>" /> <input type="hidden" id="savetotable" name="savetotable" value="1" /> <?php foreach($LabelList as $c_name){ ?> <div> <div style="float: left; width: 300px;"; > <?php echo $c_name; ?> </div> <div style="float: left; width: 400px;"> <select id="<?php echo $c_name; ?>" name="<?php echo $c_name; ?>"> <option value=""></option> <?php foreach($SourceColumns as $h_name){ ?> <option value="<?php echo trim($h_name); ?>"> <?php echo trim($h_name); ?> </option> <?php } ?> </select> </div> <div style="clear: both;"></div> </div> <?php } ?> <input type="submit" value="Save to Database" /> </form> So, while I could load the data into the targetfile pretty easily using the real target table column names, how can I present the user with a drop-down menu of LABELS, but insert the data into the REAL target fields? Here's the list of ACTUAL fields: $output = array(); $gather = 'select FieldName from MapTable where User = UserID' $this->call($gather); foreach($this->data as $row){ $ActualFields[] = $row['COLUMN_NAME']; } return $ActualFields; } Here's the list of LABELS (phony field names): $output = array(); $gather = 'select LabelName from MapTable where User = UserID' $this->call($gather); foreach($this->data as $row){ $LabelList[] = $row['COLUMN_NAME']; } return $LabelList; } The list of fields from the sourcefile the user is loading are all actual, real names ($SourceColumns)
  7. I see that the values -- _POST, _SESSION, global variables, never survive the first FORM. Perhaps a new call to the main function initializes the entire environment? Is that any clue? Mark
  8. It's in a lot of files. But basically, Is there some general rule that would allow me to transfer any value or variable from function A to function B and then have multiple forms call function B again, saving that value? You would THINK that a global variable would do it. That choosing various names for that variable would make collision improbable. That $_SESSION, for example, would be one of those variables. That if the control never left my functions, regardless of what occurred before or after those functions, that at least in MY functions, I would have access to that value. But no. Something is clobbering these values as though it's an entirely new execution context. As though there's no way to keep a global value through repeated calls to Function B. There's something probably terribly obvious that I'm missing (I did try calling start_session() again at the top of each of the functions A and B, one at a time, and also in the calling function -- no effect.) Is there something in my test environment -- a windows PC running XP -- wherein repeated calls might have some strange effect??? It's driving me absolutely NUTS. Mark
  9. It's called in preceding code. Do I need to call it in my function as well? Would that initialize the structure and run the risk of breaking the upper level code? I'll give that a shot. Do other superglobals, such as $_POST, have similar rules or support functions? Thanks! Mark
  10. I've circumvented this problem temporarily by placing the "companyID" value inside $_POST['companyID'], which transfers fine. Either there's something unique to $_SESSION ( Duh ), or I've munged something obvious that's just become invisible to me through too much looking at code (Duh**2). Now, if I could screw something up badly by using $_POST for awhile, please feel free to berate me soundly, just in case. Mark
  11. The following works swimmingly if I hardcode the "company ID" value at the top of the file. Each time this function is called, the "company ID" value -- whether stored in a static or global or local variable, such as $my_companyID or $_SESSION['companyID'], no longer prints out. <?php set_time_limit(0); require_once 'C:\mpower\slipstream\trunk\www\administrator\uploader-inserter\Xsettings.php'; require_once 'C:\mpower\slipstream\trunk\www\administrator\uploader-inserter\class\util.php'; require_once 'C:\mpower\slipstream\trunk\www\administrator\uploader-inserter\class\msdb.php'; require_once 'C:\mpower\slipstream\trunk\www\administrator\uploader-inserter\class\import_exception.php'; require_once 'C:\mpower\slipstream\trunk\www\administrator\uploader-inserter\class\table_loader.php'; $connfail = false; $table1_name = 'company'; $table2_name = 'ContactMap'; $my_companyid = $_SESSION['company_id']; # display variables $display_form = false; $headers = array(); $errors = array(); if(isset($_POST['unique'])){ $unique_nm = $_POST['unique']; }else{ $unique_nm = microtime(false); $unique_nm = str_replace(" ", "", $unique_nm); $unique_nm = str_replace(".", "", $unique_nm); } # path to save file as $dest = dirname(__FILE__) . '\\'. FILE_UPLOAD_DIR . '\\' . $unique_nm; ## load spreadsheet into database table via form translation if(isset($_POST['savetotable'])){ $db = new table_loader(); print_r($my_companyid); print_r($_SESSION['company_id']); $columns1 = $db->get_table_columns($table1_name); $columns2 = $db->get_target_columns($my_companyid); # $columns = array('id', 'name', 'quantity', 'other'); # gather data from csv file $data = util::parse_csv_file_data($dest); $translate1 = array(); $translate2 = array(); # gather translation from form foreach($columns1 as $table1_column){ if(isset($_POST[$table1_column]) && $_POST[$table1_column] != ''){ $translate1[$_POST[$table1_column]] = $table1_column; } } foreach($columns2 as $table2_column){ if(isset($_POST[$table2_column]) && $_POST[$table2_column] != ''){ $translate2[$_POST[$table2_column]] = $table2_column; } } # save data to database $total_inserted1 = $db->save_datasets($table1_name, $data, $translate1); $total_inserted2 = $db->save_datasets($table2_name, $data, $translate2); echo 'You have just uploaded ' . $total_inserted1 . ' fully-screened, processed and verified records.'; exit; }elseif(isset($_POST['tableupload'])){ ## setup to display form to translate spreadsheet to database table # validate and upload file $errors = util::upload_file('table', $dest, array("text/csv", "text/comma-separated-values", "application/csv", "application/excel", "application/vnd.ms-excel", "application/vnd.msexcel", "text/anytext")); if(!empty($errors)){ $display_form = true; }else{ # gather csv headers $headers = util::parse_csv_file_headers($dest); $db = new table_loader(); # columns1 are table column names ("company") $columns1 = $db->get_table_columns($table1_name); # columns2 are actual final target table columns names in # "Contact" (derived from "ContactMap"), and labels will be derived from those $columns2 = $db->get_target_columns($table2_name); # $columns = array('id', 'name', 'quantity', 'other'); ###################################################### ### Second Page Form ###################################################### ?> <form action="http://localhost/jetstream/administrator/uploader-inserter/Xpage_data_import.php" method="post"> <input type="hidden" id="unique" name="unique" value="<?php echo $unique_nm; ?>" /> <input type="hidden" id="savetotable" name="savetotable" value="1" /> <?php foreach($columns1 as $c_name){ ?> <div> <div style="float: left; width: 300px;"; > <?php echo $c_name; ?> </div> <div style="float: left; width: 400px;"> <select id="<?php echo $c_name; ?>" name="<?php echo $c_name; ?>"> <option value=""></option> <?php foreach($headers as $h_name){ ?> <option value="<?php echo trim($h_name); ?>"> <?php echo trim($h_name); ?> <?php print_r($_SESSION); ?> </option> <?php } ?> </select> </div> <div style="clear: both;"></div> </div> <?php } ?> <?php foreach($columns2 as $c_name){ ?> <div> <div style="float: left; width: 300px;"; > <?php echo $c_name; ?> </div> <div style="float: left; width: 400px;"> <select id="<?php echo $c_name; ?>" name="<?php echo $c_name; ?>"> <option value=""></option> <?php foreach($headers as $h_name){ ?> <option value="<?php echo trim($h_name); ?>"> <?php echo trim($h_name); ?> </option> <?php } ?> </select> </div> <div style="clear: both;"></div> </div> <?php } ?> <input type="submit" value="Save <?php echo trim($table1_name); ?> and <?php echo trim($table2_name); ?> to Database?" /> </form> <?php } }else{ $display_form = true; } ###################################################### ### First Page Form ###################################################### if($display_form){ if(!empty($errors)){ foreach($errors as $an_error){ ?> <ul> <li><?php echo $an_error; ?></li> </ul> <?php } } ?> <div class="module_container" id="divContactList"> <p> <form action="http://localhost/jetstream/administrator/uploader-inserter/Xpage_data_import.php" method="post" enctype="multipart/form-data"> <input type="hidden" id="tableupload" name="tableupload" value="1" /> <input type="file" id="table" name="table" /> <input type="submit" id="enter" value="Upload CSV File with ONE Row of Labels, NO Empty Columns:" /> </form> <?php } ?>
  12. No -- it seems that I'm retaining control the whole time and not calling start_session at all. The flow is: MAIN_FUNCTION (uses $_SESSION variable successfully, sets $_SESSION['companyID'] properly, never writes to it again) Calls FORM1 - which calls the MAIN_FUNCTION again Inside MAIN_FUNCTION, $_SESSION['companyID'] no longer prints out. And NEITHER does the $my_company variable that was set to the same value. And I've tried to set $my_company to a global and to static variables, but the company ID value never makes it to the next call of the MAIN_FUNCTION. Mark
  13. Well, folks, thanks to all the help, I've narrowed my problem down to needing a way to allow a variable value to traverse into subsequent calls of a function. I have a simple integer - "companyID", and it's set in "actionfile.php" which is called by two forms. The first time it's called by Form A, it's set. I'd LIKE to put it into $_SESSION, but apparently $_SESSION is zeroed out before I can use it in the second call to "actionfile.php" by Form B. A new form/function call is a new session? I've tried setting it to global and static, to no avail. Anything more elegant than writing the value to SQL for later retrieval? Thanks! Mark
  14. I've got some PHP code that accesses SQL on an Amazon cloud server. Other machines running Unix and Windows can perform accesses fine using the server name (IP for Windows, label for Unix), database name (string) and a password (string). However, the same code FAILS on OSX (my Macbook Pro). SQL managers on my MBP have no problem accessing it, since I've made the proper exceptions on the AWS firewall. But PHP can't do any MS SQL reads of this database. Is there something else I don't know? Is there some other key information being exchanged that my MBP needs to send that I can't see? TIA!!
  15. I need to allow a user to input a CSV file and to display what they've got, possibly for corrections. I'm thinking of limitations for filesize, what happens if the columns overlap the page, and realtime. What seems to be a good way of providing this functionality? Any suggestions? Thanks! Mark
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.