Re: [PHP-DB] Tutorial?
On Sun, 2002-03-03 at 08:18, Jennifer Downey wrote: Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. If I understood the question; wouldn't this produce the desired result? INPUT TYPE=submit NAME=submit ?php if (isset($disabled)) { echo DISABLED; }? VALUE=whatever If $disabled is set, the button is rendered grayed out, but still visible. -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] WHERE clause
Jennifer, Wondering do I have to have the WHERE clause in a select query? $b=mysql_query( SELECT * FROM my_table) -can I use something like this or do I have to put WHERE in the statement? Hate to answer a question with a question, but what happened when you tried typing this query into the MySQL client? (a far faster solution than waiting for someone on the list to get back to you!) RTFM: 6.4.1 SELECT Syntax SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] [HIGH_PRIORITY] [DISTINCT | DISTINCTROW | ALL] select_expression,... [INTO {OUTFILE | DUMPFILE} 'file_name' export_options] [FROM table_references [WHERE where_definition] [GROUP BY {unsigned_integer | col_name | formula} [ASC | DESC], ...] [HAVING where_definition] [ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC] ,...] [LIMIT [offset,] rows] [PROCEDURE procedure_name] [FOR UPDATE | LOCK IN SHARE MODE]] When you read these 'template' commands in the manual, if the word/clause/construct is enclosed in square brackets, eg [WHERE where_definition] then it is optional. Thus the minimalist SELECT statement looks like: SELECT select_expression,... which will only work with some scalar expression, eg SELECT 2+2; or SELECT month( '2002-03-04' ); so the minimum to work with a table is: SELECT select_expression,... FROM table_references and you're bang on the money! Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Retrieving a date.
In article [EMAIL PROTECTED], Ken Thompson wrote: Great, that explains better than most of the tutorials I've read. It is unfortunate that most if not all reference documentation expect the reader to have a college degree just on their subject in order to understand wot in 'ell they're saying. if thats the impression you have, you're not looking hard enough. There are a particularly good (read, understandable) bunch of tutorials at: hotwired.lycos.com/webmonkey/programming/php/tutorials but, simply plugging php mysql tutorial (without the quotes) into google (or whatever search engine you prefer) should turn up all the information that you could possibly use. -- Rgds Ralph -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: WHERE clause
In article [EMAIL PROTECTED], Jennifer Downey wrote: $b=mysql_query( SELECT * FROM my_table) -can I use something like this or do I have to put WHERE in the statement? you only need a WHERE clause when you want to limit the result set from the query. If you want or need to retrieve all the rows in the data base, your SELECT statement is sufficient. -- Rgds Ralph -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] WHERE clause
MySQL is very well documented as well. www.mysql.com, click on documentation. Dl Neil [EMAIL PROTECTED] wrote in message 160001c1c356$2f629c40$c200a8c0@jrbrown..">news:160001c1c356$2f629c40$c200a8c0@jrbrown..; Jennifer, Wondering do I have to have the WHERE clause in a select query? $b=mysql_query( SELECT * FROM my_table) -can I use something like this or do I have to put WHERE in the statement? Hate to answer a question with a question, but what happened when you tried typing this query into the MySQL client? (a far faster solution than waiting for someone on the list to get back to you!) RTFM: 6.4.1 SELECT Syntax SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] [HIGH_PRIORITY] [DISTINCT | DISTINCTROW | ALL] select_expression,... [INTO {OUTFILE | DUMPFILE} 'file_name' export_options] [FROM table_references [WHERE where_definition] [GROUP BY {unsigned_integer | col_name | formula} [ASC | DESC], ...] [HAVING where_definition] [ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC] ,...] [LIMIT [offset,] rows] [PROCEDURE procedure_name] [FOR UPDATE | LOCK IN SHARE MODE]] When you read these 'template' commands in the manual, if the word/clause/construct is enclosed in square brackets, eg [WHERE where_definition] then it is optional. Thus the minimalist SELECT statement looks like: SELECT select_expression,... which will only work with some scalar expression, eg SELECT 2+2; or SELECT month( '2002-03-04' ); so the minimum to work with a table is: SELECT select_expression,... FROM table_references and you're bang on the money! Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP, Oracle and multipage transactions
Hello, is there a way to store an Oracle session in a PHP session so the transaction would carry over from one page to another? Initially I thought that using OCIPlogin and storing the connection variable into a PHP session would solve it, but it wasn't the way I had hoped it to be Seems that when the current page (php) has finished executing the Oracle transaction/session is ended If there is no way to do that in the current version of PHP, maybe someone has modified the PHP source code to do exactly that ?) And oh, the environment: Oracle9i Database with PHP 411 on a WinNT server -- PHP Database Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
RE: [PHP-DB] PHP + Oracle + Redhat Linux Stupid Question Maybe? Sorry
Jason, Or you can use ODBC, as per the HOWTO at www.iodbc.org, which eliminates the ned to install the Oracle client and enables you to develop applications independent of database. Best regards, Andrew Hill Director of Technology Evangelism http://www.openlinksw.com/virtuoso/whatis.htm OpenLink Virtuoso Internet Data Integration Server -Original Message- From: Steve Farmer [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 03, 2002 7:16 PM To: Jason Lehman; [EMAIL PROTECTED] Subject: Re: [PHP-DB] PHP + Oracle + Redhat Linux Stupid Question Maybe? Sorry Hi Jason, You need the Oracle client installed and working rgds Steve At 11:39 AM -0500 1/3/02, Jason Lehman wrote: This may be a stupid question but I am stuck. Do I have to have the Oracle Linux Client to connet to a remote Oracle Database or can I just have the php --with-oci8 turned on and that be it? And I can't seem to find any how-tos on just installing the client and I am not sure what prerequisites I need on my computer to install just the client. Any help would be appreciated. Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Minds are like parachutes, they work best when open Support free speech; visit http://www.efa.org.au/ Heads Together Systems Pty Ltd http://www.hts.com.au Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] optimization (another tack)
Let me try this again more generally I am trying to optimize a function in PHP that handles very large result sets, which are transferred to arrays, and that does some extremely heavy lifting in terms of calculations on those arrays By design, it iterates through each possible combination of two result sets, and does some calculations on those results As you can imagine, the numbers get quite large, quite fast; sets of 500 by 1000 necessitate a half-million calculations So, short of rewriting this function in C, which I cannot do, are there any suggestions for optimizing For example: 1) is there any advantage to caching an array as a local file? 2) the script pumps the results of the calculations into a new table would it be faster to dump it into a local file instead? 3) is there any advantage to executing the script as a CGI? (does that make sense? I don't know if I know the correct jargon here) Any other tips folks have for scripts that handle a lot of calculations would be greatly appreciated Thanks in advance -- PHP Database Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
RE: [PHP-DB] optimization (another tack)
If you are using php and a database you can add more memory to the script and optimize the database. I only use postgres databases for all my large data so I can let you know how to optimize postgres... Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:02 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] optimization (another tack) Let me try this again more generally. I am trying to optimize a function in PHP that handles very large result sets, which are transferred to arrays, and that does some extremely heavy lifting in terms of calculations on those arrays. By design, it iterates through each possible combination of two result sets, and does some calculations on those results. As you can imagine, the numbers get quite large, quite fast; sets of 500 by 1000 necessitate a half-million calculations. So, short of rewriting this function in C, which I cannot do, are there any suggestions for optimizing. For example: 1) is there any advantage to caching an array as a local file? 2) the script pumps the results of the calculations into a new table.. would it be faster to dump it into a local file instead? 3) is there any advantage to executing the script as a CGI? (does that make sense? I don't know if I know the correct jargon here...) Any other tips folks have for scripts that handle a lot of calculations would be greatly appreciated. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] optimization (another tack)
Title: Message Here is general information on postgres: http://www.ca.postgresql.org/docs/aw_pgsql_book/index.html Here is an optimization file included: This was not written by me!!! Let me know if you have questions...s Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message-From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:10 AMTo: Hunter, RaySubject: RE: [PHP-DB] optimization (another tack) That would be great! Thanks. [Aron Pilhofer] -Original Message-From: Hunter, Ray [mailto:[EMAIL PROTECTED]]Sent: Monday, March 04, 2002 11:04 AMTo: 'Aron Pilhofer'; [EMAIL PROTECTED]Subject: RE: [PHP-DB] optimization (another tack) If you are using php and a database you can add more memory to the script and optimize the database. I only use postgres databases for all my large data so I can let you know how to optimize postgres... Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:02 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] optimization (another tack) Let me try this again more generally. I am trying to optimize a function in PHP that handles very large result sets, which are transferred to arrays, and that does some extremely heavy lifting in terms of calculations on those arrays. By design, it iterates through each possible combination of two result sets, and does some calculations on those results. As you can imagine, the numbers get quite large, quite fast; sets of 500 by 1000 necessitate a half-million calculations. So, short of rewriting this function in C, which I cannot do, are there any suggestions for optimizing. For example: 1) is there any advantage to caching an array as a local file? 2) the script pumps the results of the calculations into a new table.. would it be faster to dump it into a local file instead? 3) is there any advantage to executing the script as a CGI? (does that make sense? I don't know if I know the correct jargon here...) Any other tips folks have for scripts that handle a lot of calculations would be greatly appreciated. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Optimizing Postgresql Ericson Smith Following Tim Perdue's excellent article on the comparison between MySQL and Postgresql, I decided to take a shot at installing and using this database. For most of our work I use MySQL and will continue to do so, because of its ease of use and unrivaled select query speed, and also because there is no point in trying to mess around with production systems that already work fine. But some new projects suffered greatly from MySQL's table locking feature when I needed to update data (which I do a lot). Here are my adventures in setting up a Postgresql database server. Our configuration for a dedicated Postgresql server was: Redhat 7.1 Dual PIII 650Mhz System 512MB RAM 18Gig SCSI drive for the postgresql data partition Downloading and Installing I downloaded and installed the 7.1.2 RPM's from http://postgres.org without any trouble. For a server installation, I only installed: postgresql-server and postgresql-7.1.2 (base). I then started the server up and running by executing: /etc/init.d/postgresql start A small sized database was ported from MySQL (three tables totaling about 5000 records). I created sufficient indexes for postgresql's optimizer to use, and modified our C application to use the postgresql C client interface for a small CGI program that would brutally query this table. This small CGI program receives thousands of queries per minute. Optimizing One of the first things I noticed after turning on the CGI program, was that although queries were returned almost as fast as from the previous MySQL based system, the load on the server was much higher -- in fact almost 90-percent! Then I started to go down into the nitty-gritty of things. I had optimized MySQL before by greatly increasing cache and buffer sizes and by throwing more ram towards the problem. The single biggest thing that you have to do before running Postgresql, is to provide enough shared buffer space. Let me repeat: provide enough buffer space! Let's say you have about 512MB of ram on a dedicated database server, then you need to turn over about 75-percent of it to this shared buffer. Postgresql does best when it can load most or -- even better -- all of a table into its shared memory space. In our case, since our database was fairly small, I decided to allocate 128MB of RAM towards the shared buffer space. The file /var/lib/pgsql/data/postgresql.conf contains settings for the database server. Postgresql
Re: [PHP-DB] optimization (another tack)
Messagethanks! Ray Hunter [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Here is general information on postgres: http://www.ca.postgresql.org/docs/aw_pgsql_book/index.html Here is an optimization file included: This was not written by me!!! Let me know if you have questions...s Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:10 AM To: Hunter, Ray Subject: RE: [PHP-DB] optimization (another tack) That would be great! Thanks. [Aron Pilhofer] -Original Message- From: Hunter, Ray [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 11:04 AM To: 'Aron Pilhofer'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] optimization (another tack) If you are using php and a database you can add more memory to the script and optimize the database. I only use postgres databases for all my large data so I can let you know how to optimize postgres... Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:02 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] optimization (another tack) Let me try this again more generally. I am trying to optimize a function in PHP that handles very large result sets, which are transferred to arrays, and that does some extremely heavy lifting in terms of calculations on those arrays. By design, it iterates through each possible combination of two result sets, and does some calculations on those results. As you can imagine, the numbers get quite large, quite fast; sets of 500 by 1000 necessitate a half-million calculations. So, short of rewriting this function in C, which I cannot do, are there any suggestions for optimizing. For example: 1) is there any advantage to caching an array as a local file? 2) the script pumps the results of the calculations into a new table.. would it be faster to dump it into a local file instead? 3) is there any advantage to executing the script as a CGI? (does that make sense? I don't know if I know the correct jargon here...) Any other tips folks have for scripts that handle a lot of calculations would be greatly appreciated. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tutorial?
Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want your request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tutorial?
I've also seen something similar implemented using javascript (i guess - never looked into it in any detail) The online bank I use does this. Basically, when I click a submit button, the button is replaced by an image (like a greyed out submit button) which has the caption Submitted. Clicking this does nothing. Like I say, I'm 99.9% positive this is implemented using javascript, but have never investigated how it works... Richy == Richard Black Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: [EMAIL PROTECTED] -Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: 04 March 2002 16:40 To: 'Jennifer Downey'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Tutorial? Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want your request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tutorial?
How about mixing the 2??? :-) Richy -Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: 04 March 2002 16:51 To: 'Richard Black'; 'Jennifer Downey'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Tutorial? Javascript will functionally solve the problem, but since Javascript is an optional piece of the browser that can be turned off/on, and functions differently in different browsers, it's definitely far from fool-proof. You could get it working 99.9% in IE and Navigator, but then have it fail in another browser, which is why I suggested my PHP, server-side method, which cannot be turned off based on a client's browser. - Jonathan -Original Message- From: Richard Black [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 8:47 AM To: Jonathan Hilgeman; 'Jennifer Downey'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Tutorial? I've also seen something similar implemented using javascript (i guess - never looked into it in any detail) The online bank I use does this. Basically, when I click a submit button, the button is replaced by an image (like a greyed out submit button) which has the caption Submitted. Clicking this does nothing. Like I say, I'm 99.9% positive this is implemented using javascript, but have never investigated how it works... Richy == Richard Black Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: [EMAIL PROTECTED] -Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: 04 March 2002 16:40 To: 'Jennifer Downey'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Tutorial? Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want your request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Tutorial?
The easiest and best solution is to redirect to a new page after the submit. But I have had cases where it was necessary to have the submit code and the form on the same page. I agree totally with jonathan that a server-side solution is the way to go. To solve the problem (avoid clicking twice and/or reloading the page) I used a hidden field that generated a unique ID based, and then placed that into a field that only accepts unique values. If the user reloads, the query fails - trap that error and you're golden. Jonathan Hilgeman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]; Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want your request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tutorial?
This is another good idea. When reloading the page, have the script generate that unique ID, store it in a separate table AND put it in a hidden input. When the user submits, the database checks to see if the unique ID is in the database, and if so, the ID is deleted from the database, and the order is processed. On subsequent clicks, the unique ID would not be found in that database table so the query would fail with a message (You have clicked more than once) or something like that, and the person could check the status of an order identified by that unique ID. - Jonathan -Original Message- From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Tutorial? The easiest and best solution is to redirect to a new page after the submit. But I have had cases where it was necessary to have the submit code and the form on the same page. I agree totally with jonathan that a server-side solution is the way to go. To solve the problem (avoid clicking twice and/or reloading the page) I used a hidden field that generated a unique ID based, and then placed that into a field that only accepts unique values. If the user reloads, the query fails - trap that error and you're golden. Jonathan Hilgeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want your request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Tutorial?
Right. I store mine in the same db, and it gets inserted with the other data from the form. Before inserting, the script does a quick query, selecting all rows where the unique_id is equal to the current ID. since a new one is generated for each submit click, the answer will be zero on a proper insert. On a reload, the answer (mysql_affected_rows) will be 1, so you exit the script at that point. I also check to make sure the required fields are not blank before inserting, so that handles the problem of inserting a blank record if the user clicks twice. anyway, it works... you can click and click and click all you want, reload until you're blue in the face, and you'll only get one proper insert. better yet, not a word of javascript was involved. :) Jonathan Hilgeman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]; This is another good idea. When reloading the page, have the script generate that unique ID, store it in a separate table AND put it in a hidden input. When the user submits, the database checks to see if the unique ID is in the database, and if so, the ID is deleted from the database, and the order is processed. On subsequent clicks, the unique ID would not be found in that database table so the query would fail with a message (You have clicked more than once) or something like that, and the person could check the status of an order identified by that unique ID. - Jonathan -Original Message- From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Tutorial? The easiest and best solution is to redirect to a new page after the submit. But I have had cases where it was necessary to have the submit code and the form on the same page. I agree totally with jonathan that a server-side solution is the way to go. To solve the problem (avoid clicking twice and/or reloading the page) I used a hidden field that generated a unique ID based, and then placed that into a field that only accepts unique values. If the user reloads, the query fails - trap that error and you're golden. Jonathan Hilgeman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]; Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want your request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a
Re: [PHP-DB] easy date format question
Hello!! it should be $today = Date(Y-m-d); Dan On Friday, March 1, 2002, at 04:50 PM, [EMAIL PROTECTED] wrote: should be simple as pie, of course, but i can't find a straightforward syntax example in the documentation. i'm trying to change the PHP date format to mysql's. my code: $today = date(MMDD); $sql = INSERT into table (date) values ('$today'); and so on... is filling the date field with zeros, instead of 2002-02-28 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Converting Image Data Directly from MySQL
Hello list, I've been stumped on this for a while, I have a large project where I am storing image data in a MySQL db for reasons I will not get into. The images are displayed as thumbnails in a table which are hyperlinks to a large file. The larger file is stored in the db as a BLOB type in GIF format. I have a nice freeware program for creating thumbnails called gifsicle. I thought the following code would work: // connect to db, set up SQL, etc. etc. etc. $image = $row[image_data]; // this is the binary GIF image data Header (Content-type: image/gif); if ($view_type == thumbnail) { passthru (/usr/bin/gifsicle --resize 320x240 . $image); } echo $image; flush(); This script works if called to view an image in full size, but if $view_type is set to thumbnail and the passthru command is executed, nothing is displayed. gifsicle generally works like this: /usr/bin/gifsicle --resize NNNxNNN src_image out_image. I have tried using system and exec as well, nothing seems to work except the following: $fp = fopen(/tmp/tmp.gif,w); fwrite($fp, $image); fclose($fp); passthru(/usr/bin/gifsicle --resize 320x240 /tmp/tmp.gif); This adds a LOT of file system I/O though as it has to write each full sized image stored in the db /tmp and slows things down quite a bit. Does anyone have any other suggestions? My goal is to store only one version of each image file and create smaller versions on the fly. PHP is 4.1.2 on a SuSE Linux 7.3 box, latest Apache server, MySQL 3.23.44. Thanks for your help! Josh Trutwin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] any php/Linux gurus out there?
you could complile the hole program instead of the rpm, just read README.install from the php source tar file. or you can install the other rpms that are lacking. or even so, not such a good ideia, but you can force the installationg using the command rpm -i --nodeps php or rpm -U --nodeps phpxxx - Original Message - From: Peter Lovatt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 04, 2002 11:52 PM Subject: [PHP-DB] any php/Linux gurus out there? Hi I am running the security upgrade and am getting the following error when I run the RPM The install is RH 7.0 and was pre-installed. I had assumed that the RPMs from Redhat would match the pre installed version, as it was standard. I am a humble programmer (and part time sys admin!), rather than a Linux/RH guru, so would appreciate some advice. What is the best way to deal with this ? error: failed dependencies: libcrypto.so.1 is needed by php-4.0.6-9.7.0 libmm.so.11 is needed by php-4.0.6-9.7.0 libssl.so.1 is needed by php-4.0.6-9.7.0 libcrypto.so.1 is needed by php-imap-4.0.6-9.7.0 --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- sql table -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] any php/Linux gurus out there?
Hello!! First uninstall your old version of php(php-4.0.6-9.7.0) Then install the new RPM If you're using the Red Hat update thingy... Or download the source and recompile it!! Dan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 5:53 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] any php/Linux gurus out there? Hi I am running the security upgrade and am getting the following error when I run the RPM The install is RH 7.0 and was pre-installed. I had assumed that the RPMs from Redhat would match the pre installed version, as it was standard. I am a humble programmer (and part time sys admin!), rather than a Linux/RH guru, so would appreciate some advice. What is the best way to deal with this ? error: failed dependencies: libcrypto.so.1 is needed by php-4.0.6-9.7.0 libmm.so.11 is needed by php-4.0.6-9.7.0 libssl.so.1 is needed by php-4.0.6-9.7.0 libcrypto.so.1 is needed by php-imap-4.0.6-9.7.0 --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- sql table -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php-db Digest 5 Mar 2002 01:49:55 -0000 Issue 1083
Without knowing what you are trying to do I get the impression you might be better off doing this via SQL rather than PHP. You say: ...very large result sets, which are transferred to arrays, and that does some extremely heavy lifting in terms of calculations on those arrays. By design, it iterates through each possible combination of two result sets, and does some calculations on those results. Why not do the heavy lifting in the DB? It¹s very easy to get the Cartesian Product (for each row of set A combine it with each row of set B) inside of a DB and then to apply calculations which would pass the row on to the final results set or drop it. Databases are optimized for this already. It may be that your calculations are too much to do inside the DB but remember that the join need not be primary key = foreign key; you have considerably more flexibility here. Beyond that you can, perhaps, do some or all of the calculations ahead of time. The DB has space to record the results and you can update these results either continuously (on idle type or thing) or as a record which was involved in the calculations changes (either figure it out on the spot of simply mark its children invalid and come back later). This can be particularly useful when you want to put up a results page quickly. Just a thought. Frank On 3/4/02 5:49 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: From: Aron Pilhofer [EMAIL PROTECTED] Reply-To: Aron Pilhofer [EMAIL PROTECTED] Date: Mon, 4 Mar 2002 11:02:18 -0500 To: [EMAIL PROTECTED] Subject: optimization (another tack) Let me try this again more generally. I am trying to optimize a function in PHP that handles very large result sets, which are transferred to arrays, and that does some extremely heavy lifting in terms of calculations on those arrays. By design, it iterates through each possible combination of two result sets, and does some calculations on those results. As you can imagine, the numbers get quite large, quite fast; sets of 500 by 1000 necessitate a half-million calculations. So, short of rewriting this function in C, which I cannot do, are there any suggestions for optimizing. For example: 1) is there any advantage to caching an array as a local file? 2) the script pumps the results of the calculations into a new table.. would it be faster to dump it into a local file instead? 3) is there any advantage to executing the script as a CGI? (does that make sense? I don't know if I know the correct jargon here...) Any other tips folks have for scripts that handle a lot of calculations would be greatly appreciated. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] any php/Linux gurus out there?
On Monday 04 March 2002 05:54 pm, Pedro M. S. Oliveira wrote: you could complile the hole program instead of the rpm, just read README.install from the php source tar file. or you can install the other rpms that are lacking. or even so, not such a good ideia, but you can force the installationg using the command rpm -i --nodeps php or rpm -U --nodeps phpxxx - Original Message - From: Peter Lovatt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 04, 2002 11:52 PM Subject: [PHP-DB] any php/Linux gurus out there? Hi I am running the security upgrade and am getting the following error when I run the RPM The install is RH 7.0 and was pre-installed. I had assumed that the RPMs from Redhat would match the pre installed version, as it was standard. I am a humble programmer (and part time sys admin!), rather than a Linux/RH guru, so would appreciate some advice. What is the best way to deal with this ? error: failed dependencies: libcrypto.so.1 is needed by php-4.0.6-9.7.0 libmm.so.11 is needed by php-4.0.6-9.7.0 libssl.so.1 is needed by php-4.0.6-9.7.0 libcrypto.so.1 is needed by php-imap-4.0.6-9.7.0 Go to www.rpmfind.net and search for the dependent library's . Use rpm -ivh to install along side any others of a different release version and you should make out OK. --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- sql table -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ken Thompson, North West Antique Autos Payette, Idaho Email: [EMAIL PROTECTED] http://www.nwaa.com Sales and brokering of antique autos and parts. Linux- Coming Soon To A Desktop Near You Registered Linux User #183936 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] any php/Linux gurus out there?
On Tuesday 05 March 2002 07:52, Peter Lovatt wrote: Hi I am running the security upgrade and am getting the following error when I run the RPM The install is RH 7.0 and was pre-installed. I had assumed that the RPMs from Redhat would match the pre installed version, as it was standard. I am a humble programmer (and part time sys admin!), rather than a Linux/RH guru, so would appreciate some advice. What is the best way to deal with this ? error: failed dependencies: libcrypto.so.1 is needed by php-4.0.6-9.7.0 libmm.so.11 is needed by php-4.0.6-9.7.0 libssl.so.1 is needed by php-4.0.6-9.7.0 libcrypto.so.1 is needed by php-imap-4.0.6-9.7.0 Have you followed the instructions given on the RH website? Most upgrades are performed using: rpm -Uvh xxx.rpm or rpm -Fvh xxx.rpm -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* I'd love to go out with you, but I'm doing door-to-door collecting for static cling. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php