[PHP] SESSION values show up days later!
Hi all, I use session variables to store values from one page to another on my website. Alas, sometimes, but not always, the values persist from one invocation of the script to another! Just how, exactly, do I make them go away when a user exits the program? I assume my users will not always be logging out explicitly. Thanks. maryfran -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cleaning up automatically when leaving a page
Hi all, I have a php application for which I have a page which creates temporary junk and puts it into a persistent store (in this case a postgres database, but that is beside the point.) I have a Save button which puts the stuff I really want into the persistent store and cleans up the temporary junk. I have a Cancel button which only cleans up the temporary junk. I would really like to have the cleanup code run anytime a user leaves the page without hitting the Save button. Is there anyway to do this? I.e. have php code called conditionally on exiting the page? Thanks Mary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP generated HTML has submit button which picks up the wrong url.
Hi, I am writing code in PHP which generates HTML script. My app is fairly complex. Twice in the development of the application I have run into a problem with submit buttons which pick up the wrong url. Instead of call the url for that submit button, it appears to call the url for the first submit button on the page. The problem may be intermittent, which seems to suggest that something funny is happening with the cache. Clearing the cache did not help in the last go around. I am including the generated html code. Hitting the button 'Retrieve all ...' should call up the url get_query_forms.php. Instead it calls up the url query_form_display_data.php, which is the url for the first submit button on the page. Any clues to clear up this mystery would be greatly appreciated! Mary Anderson http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Display Data action=./query_form_display_data.php?perm_batch_file=perm&pg_query_form_id=518&data_table_id=255&data_batch_id=&query_form_schema=permanent_queries&batch_input_file_id=&create_tmp_data_tables=0"> 72 rows have been returned by this query http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" > http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" > http://unproto.demog.berkeley.edu/memdemo/query_form_display_data.php?worksheet_join_element_initialize=1&perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" > http://unproto.demog.berkeley.edu/memdemo/edit_query_form.php?perm_batch_file=perm&pg_query_form_id=518&query_form_schema=permanent_queries'" > http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=permanent_queries&user_name=&data_table_type_id='" > http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file='perm'&query_form_schema=temporary_queries&user_name=&data_table_type_id='" > http://unproto.demog.berkeley.edu/memdemo/get_query_forms.php?perm_batch_file=perm&user_name='" > http://unproto.demog.berkeley.edu/memdemo'" > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php code compiles, produces good html output, but crashes when put through browser
Hi, Need some help with debugging procedures. This is a postgresql/PHP running with PHP 5. I have used both IE7 and mozilla 5.0 with this file. The postgres part works fine, and the html that is generated is OK, but the .php file hangs when I run it through the browser. I have two tables -- data_series and data_sets with a 1-many relation between the data_series and data_sets. My page first displays the data_series in a . Then it pulls the data_sets belonging to user selected data_series and displays them in a select. There are links to .php files to process the selected data_set. My code http://demog.berkeley.edu/~maryfran/memdev/get_data_set.php compiles OK when I run php on it from the shell. It produces html forms which will load into the browser and run as expected. However when I try to run the .php file in the browser it parses the head, displays the title, and then hangs. No error messages are displayed, even though I have called error_reporting(E_ALL) at the very top of the .php file. I had an echo statement on each line of php code. None were printed out. I checked permissions on the .php file. Changing them did not improve the situation. I need some basic debugging tools that I don't have to figure out what is going on. Alas, I think this code would hang before it got to the debugger! Any advice is appreciated. At this point I am clueless. Mary Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to pass selected options to .php file when two scrolling lists appear at different times on page
ions_cmd SQL statement used to retrieve values for the rows // default_idsids of rows to be highlighted when scrolling list is displayed //Action: display scrolling list with formatted rows of values retrieved by select_cmd. function echo_scrolling_list_from_database( $name, $class, $label, $size, $multiple_OK, $pg, $select_options_cmd, $default_ids){ echo_scrolling_list_tag($name, $class, $label, $size, $multiple_OK); $id_colon_displays = do_select_and_format_many($pg, $select_options_cmd); foreach ($id_colon_displays as $id_colon_display){ echo_option_tag($id_colon_display, $default_ids); } echo ""; } Thanks! Mary Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re:how to pass selected options to... Ignore last letter. Program works
Hi all, Knew I should have tried it one more time before firing off the last letter. The page is now working properly. Apologies and thanks mary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] why is Japan not highlighted
in my scrolling list? Here is the offending code (abbreviated) Italy Japan Jersey Jiangsu Jiangxi I have data series which have a location specified. I wish to edit the data series. I select the location from the database (Note: database stuff is not a problem) and display a scrolling list with the location specified by that data series highlighted. Problem is, even though the option is marked selected, the Japan entry in the scrolling list does not highlight. The offending page may be viewed at http://www.demog.berkeley.edu/~maryfran/memdev/edit_series.php?sr_data_series_id=2 Sometimes when it loads, Japan is highlighted correctly. Sometimes nothing is highlighted. Sometimes some random option in the list is highlighted. Similar behavior is observed in the data series types scrolling list next to the locations list on the page. I have been using Firefox 2.0.0.3. I just tried it out on IE7 and it seems to work OK. Maybe it is a browser problem, but the XDynamic HTML Definitive Reference seems to say that the selected attribute on option works OK with mozilla. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing _GET values to _POST
Hi all, I have a screen get_collection.php which is supposed to be used to select something called 'data sets'. My database (the postgres database is not the problem, PHP is) has an entity called 'data series' which has a child entity called 'data sets'. The user is first shown a list of all the data series. He selects a subset and pushes a submit button. The database supplies the names of the children of the selected data series, which are then displayed in the scrolling list called 'data sets'. My problem is getting the various screens in my application to talk to each other. I have another screen called edit_reference.php which is used to edit a reference with an id re_reference_id. Midway through this screen I want to link the reference of re_reference_id to data series and data sets chosen by the user by following a link from edit_reference.php to get_collection.php. I thought I could just give re_reference_id to get_collection as an url variable. Unfortunately, this doesn't work. Pushing the submit button to actually select the data series of interest causes the $_GET to be forgotten. Printing the value of re_reference_id in a hidden inpput field -- which I thought for sure would end up in the $_POST array when I hit the get_data_series submit button doesn't work either. Neither does just saying $_POST['re_reference_id'] = $re_reference_id. Probably I should be using session variables here. But I think they will have their own problems since they will be written on edit_reference.php, remembered long after the call to get_collections, and may cause trouble later. My page is http://www.demog.berkeley.edu/~maryfran/memdev/get_collection.php?re_reference_id=74 I am going to attach the php code and hope it makes it through. Mary Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP debugger recommendations, anyone?
Hi all, I am getting tired of writing echo statements for almost every parameter, then deleting them while I am writing code. I would really like a debugger which would work with my browser. I have run across an open source one, Xdebug, and would like to hear of other's experience with it. 2.0.2 is, I believe, the latest release. Mary Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: temprorary error
Hey guys, Isn't this thread a bit OT? Anyway, as areligious person I have to say that I really do not like to hear religions trashed and smeared the way you are doing. And just for the record, we Quakers do not believe God tells us to kill people and we have no priests. Mary Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP code to write excel spreadsheet with multiple workbooks
Hi all, I have a linux based web app which prints an html screen of results. My users really want Excel spreadsheets with the same results. There is a PEAR application which does this, but from the PEAR description it seems to be pretty buggy (65 open bugs, average days open 616 days) and dated. My spreadsheets will be somewhat simple. They will have multiple workbooks and could be as large as 1 rows spread out over 100 workbooks (Bigger than the code can handle, according to one of the open bug reports). No colors, no formulas, no hyperlinks. I've checked the archives and found an example which shows me how to write the results of an SQL (MySQL, I am using postresql, but the example will still work) into a very simple Excel spreadsheet with just one table of results. Is there a way to get a php program to generate a spreadsheet with multiple workbooks? Thanks Mary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] new lines in textareas?
Hi all, I have a php script which produces text which is to be displayed in a textarea. I have the wrap for the text area set to 'hard'. I need to have newlines inserted in the text. "\n" and "" don't work. They just get quoted literally in the text. I suspect I need to use htmlspecialchars , but don't know what special character to feed it. Apologies if this should go to an HTML forum. I checked several archives and did not find anything useful. (They tended to tell me to put in \n or !) Thanks Mary Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Loading 2M array crashes program .. but only some of the time
Hi all, I have a php - postgresql program which bombs with a statement that it has run out of memory. I am running php 5.1.6 and postgres 8.3.something. My program bombs, saying that it fails to allocate memory, when it is loading an SQL query result into a php array using pg_fetch_all. The SQL query works fine when I run it in psql. I am running php with a process limit size of 16M. Some of the time this query works, sometimes it dies. It is my impression that it dies after I have been running the php application for a while -- like there is memory that isn't being cleared up. But that is only an impression! What could be going wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Still need help with some kind of memory leak in my php database program. General hints for php would help
Hi, Something in my program is eating up memory. I am running php 5 and hooking into postgres8.3, but I don't think it is a database program. The command in question works fine in psql, the problem comes in loading a php variable. And in the past, unsetting the variable has helped. The program itself is perhaps 1000 lines long, so I won't post it. I tried to isolate the problem with this code: require_once('/hdir/0/maryfran/unproto/memdev/config_file.php'); // connects to database require_once('/hdir/0/maryfran/unproto/memdev/DMEM_stuff.php'); // has constants for app function do_select_many($pg, $select_cmd){ global $DMEM_ERROR, $DMEM_DEBUG; @pg_connection_status($pg) === PGSQL_CONNECTION_OK or die("Database connection bad.\n"); $sql_result = @pg_query($pg, $select_cmd); if (pg_result_status($sql_result) != PGSQL_TUPLES_OK){ if ($DMEM_DEBUG){ echo pg_last_error($pg); echo "\n\n"; echo $select_cmd; echo "\n\n"; } return array($DMEM_ERROR); } $values_hashed_by_column = pg_fetch_all($sql_result); ///WHERE THE APPLICATION BOMBS pg_free_result($sql_result); return $values_hashed_by_column; } function fu_bar($pg, $sql_cmd){ $foo = do_select_many($pg, $sql_cmd); return($foo); } $BIG_SELECT_cmd = " SELECT value, x.d8_dv_id, x.dm2_dv_id, x.dm1_dv_id, x.d5_dv_id, x.d7_dv_id, x.xp_data_batch_id, x.xp_sub_batch_id FROM display.tmp_xprod_table x LEFT JOIN display.tmp_data_values v ON x.d8_dv_id = v.d8_dv_id AND x.dm2_dv_id = v.dm2_dv_id AND x.dm1_dv_id = v.dm1_dv_id AND x.d5_dv_id = v.d5_dv_id AND x.d7_dv_id = v.d7_dv_id AND x.xp_data_batch_id = v.data_batch_id AND x.xp_sub_batch_id = v.sub_batch_id ORDER BY x.d8_value_rank, x.dm2_value_rank, x.dm1_value_rank, x.d5_value_rank, x.d7_value_rank, x.xp_dmem_status, x.xp_created_date "; $many_selected = fu_bar($pg, $BIG_SELECT_cmd); // IF I RUN THIS THROUGH A LOOP: // for($j=0;$j<20, $j++){ $many_selected[$jj] = fu_bar($pg, $BIG_SELECT_cmd)} THE TEST PROGRAM CRASHES so I think I have more copies of the result of this query than I need. ?> //Code which prints a submit button () BIG_SELECT is the only command which pulls a significant amount of data (40K to 2M) into the database. In the real application, executing the function which runs this command results in an memory fault at the point in do_select_many that I have indicated. However, this piece of test code runs just fine! And the BIG_SELECT_cmd works just fine when cut and pasted directly into psql. Sometimes, even the real application will work just fine. I am stymied. I can neither isolate the problem in a piece of test code, nor can I reliably fix the problem when it occurs. Any help on debuggers which will find memory leaks in php code, (Yeah. PHP 5.2 has some!) or tricks of the trade in finding them, or tips on where to look would be greatly appreciated. At this point, I really do not know when and where php frees memory. Let me be a little more specific: 1. Does passing a large array as a reference into or out of a function save space? 2. Suppose I hit a submit button. Are all the variables on the page still taking up space? 3. Any known bugs with pg_fetch_all running on 8.3? How do I find them? 4. Suppose I follow a link. Do my variables on the old page still take up space? 5. Should I be handling my arrays one chunk at a time? 6. When I exit a php function, isn't all the space used by function variables freed? 7. Why would it sometimes work to clear the cache? This problem seems to me to be an intermittent one. 8. Most important, what good programming practices should I be following to keep this from happening? Mary Anderson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php