php-general Digest 29 Oct 2011 10:53:25 -0000 Issue 7543
php-general Digest 29 Oct 2011 10:53:25 - Issue 7543 Topics (messages 315517 through 315534): Re: Why does this script run out of memory? 315517 by: Daniel Brown 315518 by: Tommy Pham 315519 by: Paul Halliday 315522 by: Jim Long 315533 by: shiplu Re: Object size 315520 by: Tommy Pham mysql_fetch_array() vs mysql_fetch_assoc() WAS: Re: [PHP] Why does this script run out of memory? 315521 by: Daniel Brown 315523 by: Paul Halliday 315525 by: Jim Long 315526 by: Daniel Brown Friday Distraction 315524 by: Nathan Nobbe 315527 by: Daniel Brown 315528 by: Eric Butera 315529 by: Nathan Nobbe 315530 by: Eric Butera 315531 by: Nathan Nobbe Re: 315532 by: Nirmalya Lahiri Zend Amf and Drupal? 315534 by: Lars Nielsen Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Fri, Oct 28, 2011 at 16:21, Jim Long p...@umpquanet.com wrote: I will try experimenting with Daniel's idea of unbuffered queries, but my understanding is that while an unbuffered result resource is in use, no other SQL transactions can be conducted. Maybe I can get around that by using one MySQL connection for the unbuffered query, and another separate MySQL connection for the incidental SQL queries that I need to perform as I process each record from the large dataset. Just for the sake of a kick-start, you could throw together a simple class and then call that quite easily. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ ---End Message--- ---BeginMessage--- On Fri, Oct 28, 2011 at 9:38 AM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. Jim, Installed from packages or standard port tree build? Did you do any tweak for the ports build? Any special compiler parameters in your make.conf? I've noticed that you used MySQL extensions. Have you tried MySQLi to see if there's any difference? Regards, Tommy ---End Message--- ---BeginMessage--- On Fri, Oct 28, 2011 at 1:38 PM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. The script below is designed to be able to WHILE it's way through a MySQL query result set, and process each row. However, it runs out of memory a little after a quarter million rows. The schema fields total to about 200 bytes per row, so the row size doesn't seem very large. Why is this running out of memory? Thank you! Jim ?php $test_db_host = localhost; $test_db_user = foo; $test_db_pwd = bar; $test_db_name = farkle; $db_host = $test_db_host; $db_user = $test_db_user; $db_name = $test_db_name; $db_pwd = $test_db_pwd; if (!($db_conn = mysql_connect( $db_host, $db_user, $db_pwd ))) die( Can't connect to MySQL server\n ); if (!mysql_select_db( $db_name, $db_conn )) die( Can't connect to database $db_name\n ); $qry = select * from test_table order by contract; if ($result = mysql_query( $qry, $db_conn )) { $n = 0; while ($row = mysql_fetch_assoc( $result )) { // process row here $n++; } // while Whats the difference between fetch_assoc and fetch_row? I use: while ($row = mysql_fetch_row($theQuery)) { doCartwheel; } on just under 300 million rows and nothing craps out. I have memory_limit set to 4GB though. Although, IIRC I pushed it up for GD not mysql issues. Same OS and php ver, MySQL is 5.1.48 ---End Message--- ---BeginMessage--- On Fri, Oct 28, 2011 at 02:57:02PM -0700, Tommy Pham wrote: On Fri, Oct 28, 2011 at 9:38 AM, Jim Long p...@umpquanet.com wrote: I'm running PHP 5.3.8 on FreeBSD 8.2 with MySQL 5.1.55. Jim, Installed from packages or standard port tree build? Did you do any tweak for the ports build? Any special compiler parameters in your make.conf? I've noticed that you used MySQL extensions. Have you tried MySQLi to see if there's any difference? Regards, Tommy MySQL server and PHP and extensions built from ports, without any local tweaks. Nothing very interesting in /etc/make.conf: MASTER_SITE_FREEBSD=1 CPUTYPE?=p3 USA_RESIDENT=YES NO_INET6=YES WITHOUT_IPV6=YES NO_I4B=true NO_BLUETOOTH=true NO_IPFILTER=true NO_KERBEROS=true NO_ATM=true # do not build ATM related programs and libraries NOUUCP=true # do not build uucp related programs NO_UUCP=true # do not build uucp related programs NO_GAMES=true NO_PROFILE=true PERL_VERSION=5.10.1 Port options for php5-extensions are: _OPTIONS_READ=php5-extensions-1.5 WITH_BCMATH=true WITHOUT_BZ2=true WITHOUT_CALENDAR=true WITH_CTYPE=true WITHOUT_CURL=true WITHOUT_DBA=true
php-general Digest 29 Oct 2011 23:47:26 -0000 Issue 7544
php-general Digest 29 Oct 2011 23:47:26 - Issue 7544 Topics (messages 315535 through 315544): create file after form completion 315535 by: Pau 315536 by: Stephen 315537 by: Ashley Sheridan 315538 by: Pau 315539 by: Ashley Sheridan 315540 by: Tedd Sperling 315541 by: Pau What is an information_id in directory 315542 by: Ernie Kemp 315543 by: Tim Streater 315544 by: Ernie Kemp Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. I want to use the variables typed in by the user to automatically create a web page with those values. In the registration form I have $name = $HTTP_POST_VARS['name']; $surname = $HTTP_POST_VARS['surname']; $post = $HTTP_POST_VARS['post']; and I would like to create an html document using those (and other) values: html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html after the form has been completed. I am a newbie to php and I have been trying to get that information somewhere, but I was not successful. A little help would be appreciated. In particular an example would be wonderful. Thanks. ---End Message--- ---BeginMessage--- On 11-10-29 12:38 PM, Pau wrote: Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. This is a subject that will take a bit of your time to understand. This web site is a good place to start: http://www.tizag.com/phpT/examples/formex.php You need to create an HTML form in your web page. The form specifies the PHP file that is the form handler. When the user clicks submit, their web browser calls your file that is the form handler and passes to it the data that they entered. Exactly what your form handler does is up to you. You can: Respond to the user Save the data in a file or database Email the data Good luck Stephen ---End Message--- ---BeginMessage--- On Sat, 2011-10-29 at 18:38 +0200, Pau wrote: Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. I want to use the variables typed in by the user to automatically create a web page with those values. In the registration form I have $name = $HTTP_POST_VARS['name']; $surname = $HTTP_POST_VARS['surname']; $post = $HTTP_POST_VARS['post']; and I would like to create an html document using those (and other) values: html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html after the form has been completed. I am a newbie to php and I have been trying to get that information somewhere, but I was not successful. A little help would be appreciated. In particular an example would be wonderful. Thanks. Instead of trying to actually create the file, why don't you pass those values across dynamically? In-fact, one PHP script could do the whole job: ?php if(isset($_POST['name'])) { $name = htmlspecialchars($_POST['name']); echo Hello $name; } else { // your form here } -- Thanks, Ash http://www.ashleysheridan.co.uk ---End Message--- ---BeginMessage--- Hello, thanks for your answers. I do have a form already and I am using it to mail the results: ?php //include //?php $HTTP_POST_VARS = $_POST; $time = date(G:i:s); $ip = getenv('REMOTE_ADDR'); $vorname = $HTTP_POST_VARS['vorname']; $nachname = $HTTP_POST_VARS['nachname']; $post = $HTTP_POST_VARS['post']; mail(exam...@example.com, New registration, time: $time ip-adress: $ip html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html ); ? --- Instead of this, I would like to dump the results into a file, ideally with a random name, taken from e.g. $$ in a specific directory Something like results/2345.html with 2345.html html head titleThis is amazing Mr. Paul/title /head body pMy surname is Smith and my address Example Street 34/p /body /html But I have no idea of how to tell php to create a file with the values from the user. thanks! On 29 October 2011 19:27, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sat, 2011-10-29 at 18:38 +0200, Pau wrote: Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. I want to use the variables typed in by the user
[PHP] Zend Amf and Drupal?
Hey List, I am making a webservice in Drupal with AMF Zend to provide some methods to a Flash app. I have now managed to use standard Drupal services (node,user and files) and I have made my own method to create users. But! ... When I try to pass on arguments from Flash to Drupal it fails. It says that it expects zero arguments but I have provided 4 arguments. I have posted some info here : http://drupal.org/node/1323678 Can you give me some guidelines? or pointers on what to do? Kind Regards Lars Nielsen www.lfweb.dk / www.gearworks.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file after form completion
On 11-10-29 12:38 PM, Pau wrote: Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. This is a subject that will take a bit of your time to understand. This web site is a good place to start: http://www.tizag.com/phpT/examples/formex.php You need to create an HTML form in your web page. The form specifies the PHP file that is the form handler. When the user clicks submit, their web browser calls your file that is the form handler and passes to it the data that they entered. Exactly what your form handler does is up to you. You can: Respond to the user Save the data in a file or database Email the data Good luck Stephen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file after form completion
On Sat, 2011-10-29 at 18:38 +0200, Pau wrote: Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. I want to use the variables typed in by the user to automatically create a web page with those values. In the registration form I have $name = $HTTP_POST_VARS['name']; $surname = $HTTP_POST_VARS['surname']; $post = $HTTP_POST_VARS['post']; and I would like to create an html document using those (and other) values: html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html after the form has been completed. I am a newbie to php and I have been trying to get that information somewhere, but I was not successful. A little help would be appreciated. In particular an example would be wonderful. Thanks. Instead of trying to actually create the file, why don't you pass those values across dynamically? In-fact, one PHP script could do the whole job: ?php if(isset($_POST['name'])) { $name = htmlspecialchars($_POST['name']); echo Hello $name; } else { // your form here } -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] create file after form completion
Hello, thanks for your answers. I do have a form already and I am using it to mail the results: ?php //include //?php $HTTP_POST_VARS = $_POST; $time = date(G:i:s); $ip = getenv('REMOTE_ADDR'); $vorname = $HTTP_POST_VARS['vorname']; $nachname = $HTTP_POST_VARS['nachname']; $post = $HTTP_POST_VARS['post']; mail(exam...@example.com, New registration, time: $time ip-adress: $ip html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html ); ? --- Instead of this, I would like to dump the results into a file, ideally with a random name, taken from e.g. $$ in a specific directory Something like results/2345.html with 2345.html html head titleThis is amazing Mr. Paul/title /head body pMy surname is Smith and my address Example Street 34/p /body /html But I have no idea of how to tell php to create a file with the values from the user. thanks! On 29 October 2011 19:27, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sat, 2011-10-29 at 18:38 +0200, Pau wrote: Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. I want to use the variables typed in by the user to automatically create a web page with those values. In the registration form I have $name = $HTTP_POST_VARS['name']; $surname = $HTTP_POST_VARS['surname']; $post = $HTTP_POST_VARS['post']; and I would like to create an html document using those (and other) values: html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html after the form has been completed. I am a newbie to php and I have been trying to get that information somewhere, but I was not successful. A little help would be appreciated. In particular an example would be wonderful. Thanks. Instead of trying to actually create the file, why don't you pass those values across dynamically? In-fact, one PHP script could do the whole job: ?php if(isset($_POST['name'])) { $name = htmlspecialchars($_POST['name']); echo Hello $name; } else { // your form here } -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file after form completion
On Sat, 2011-10-29 at 19:52 +0200, Pau wrote: Hello, thanks for your answers. I do have a form already and I am using it to mail the results: ?php //include //?php $HTTP_POST_VARS = $_POST; $time = date(G:i:s); $ip = getenv('REMOTE_ADDR'); $vorname = $HTTP_POST_VARS['vorname']; $nachname = $HTTP_POST_VARS['nachname']; $post = $HTTP_POST_VARS['post']; mail(exam...@example.com, New registration, time: $time ip-adress: $ip html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html ); ? --- Instead of this, I would like to dump the results into a file, ideally with a random name, taken from e.g. $$ in a specific directory Something like results/2345.html with 2345.html html head titleThis is amazing Mr. Paul/title /head body pMy surname is Smith and my address Example Street 34/p /body /html But I have no idea of how to tell php to create a file with the values from the user. thanks! On 29 October 2011 19:27, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sat, 2011-10-29 at 18:38 +0200, Pau wrote: Dear all, I am looking for information on how to have a file created after a user has hit a submit on a registration form. I want to use the variables typed in by the user to automatically create a web page with those values. In the registration form I have $name = $HTTP_POST_VARS['name']; $surname = $HTTP_POST_VARS['surname']; $post = $HTTP_POST_VARS['post']; and I would like to create an html document using those (and other) values: html head titleThis is amazing Mr. $name/title /head body pMy surname is $surname and my address $post/p /body /html after the form has been completed. I am a newbie to php and I have been trying to get that information somewhere, but I was not successful. A little help would be appreciated. In particular an example would be wonderful. Thanks. Instead of trying to actually create the file, why don't you pass those values across dynamically? In-fact, one PHP script could do the whole job: ?php if(isset($_POST['name'])) { $name = htmlspecialchars($_POST['name']); echo Hello $name; } else { // your form here } -- Thanks, Ash http://www.ashleysheridan.co.uk Please try not to top post. To create a file, look into the fopen() function on php.net, which has plenty of examples on how to create a file. Creating one with a new name to avoid conflicts with other files on the system is a little more tricky, but it's not too difficult. What I asked in my earlier post though was whether you really need to create a new HTML file from PHP or you just need to display the results to the user? -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] create file after form completion
On Oct 29, 2011, at 12:38 PM, Pau wrote: -snip- I am a newbie to php and I have been trying to get that information somewhere, but I was not successful. A little help would be appreciated. In particular an example would be wonderful. Thanks. Pau: http://webbytedd.com/simple-stuff/post/index.php I leave the header and footer up to you. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file after form completion
Hi, Please try not to top post. sorry, but I do not understand the expression (I am not native, as you might have guessed). Do you mean not to include the email in my reply? Sorry about that. To create a file, look into the fopen() function on php.net, which has plenty of examples on how to create a file. Creating one with a new name to avoid conflicts with other files on the system is a little more tricky, but it's not too difficult. I will look into that, thanks. What I asked in my earlier post though was whether you really need to create a new HTML file from PHP or you just need to display the results to the user? I really would like to create the file, if it is not too much trouble. The user will not get to see the results until the file and contents are checked. thanks, Pau -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is an information_id in directory
2 - Make a new content area in Site Manager-Content Manager. It doesn't matter what you put in your content area, you could just put This is my new content area or Hello World if you so choose. 3 - Grab the information_id of the new content area you made. When you are editing a content area that already exists, the information_id can be gotten from the update page URL. I'm having trouble understanding this request: 1. In item #2 the client wishes to put content here, I can only guess he means a file with text in it. ? 2. Item #3 I know what an ID is but not in this context. I'm don't understand what the client wishes here.?? Any help here would be appreciated. ../Ernie
Re: [PHP] What is an information_id in directory
On 29 Oct 2011 at 20:46, Ernie Kemp ernie.k...@sympatico.ca wrote: 2 - Make a new content area in Site Manager-Content Manager. It doesn't matter what you put in your content area, you could just put This is my new content area or Hello World if you so choose. 3 - Grab the information_id of the new content area you made. When you are editing a content area that already exists, the information_id can be gotten from the update page URL. I'm having trouble understanding this request: 1. In item #2 the client wishes to put content here, I can only guess he means a file with text in it. ? 2. Item #3 I know what an ID is but not in this context. I'm don't understand what the client wishes here.?? Any help here would be appreciated. I think you posted an HTML-formatted email with images to this list. That is a waste of time (images are stripped). You'll need to send another email formatted as text-only. As it stands your mail made no sense at all. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] What is an information_id in directory
2 - Make a new content area in Site Manager-Content Manager. It doesn't matter what you put in your content area, you could just put This is my new content area or Hello World if you so choose. 3 - Grab the information_id of the new content area you made. When you are editing a content area that already exists, the information_id can be gotten from the update page URL. I'm having trouble understanding this request: 1. In item #2 the client wishes to put content here, I can only guess he means a file with text in it. ? 2. Item #3 I know what an ID is but not in this context. I'm don't understand what the client wishes here.?? Any help here would be appreciated. ../Ernie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP syntax - novice question
On 30/10/2011, at 1:15 PM, Phil Dobbin wrote: Hi, all. I’m new to the list PHP in general have a syntax question. I have a script that calls both DB MDB2. This is the part of the script where the error occurs: if($type == DB) { $db = DB::connect($dsn); if (PEAR::isError($db)) { die($db-getMessage()); } $db-setFetchMode(DB_FETCHMODE_ASSOC); $res = $db-query( 'SELECT * FROM users'); if (PEAR::isError($res)) { die($res-getMessage()); } echo ‘pre’; while( $res-fetchInto( $row ) ) { print_R($row); } echo ‘/pre’; } else if($type == MDB2) { $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage()); } $res = $mdb2-query( 'SELECT * FROM users'); // Always check that result is not an error if (PEAR::isError($res)) { die($res-getMessage()); } echo ‘pre’; while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) { print_R($row); } echo ‘/pre’; } ### The syntax checker calls the first instance ofecho ‘pre’; saying unexpected I’m at a loss to understand why... I’m using PHP 5.3.8 PEAR 1.9.4 with MySQL 5.1.59 on Mac OS X 10.6.8. Any help appreciated. Cheers, Phil. It seems as though your editor has changed the normal quotes around pre into pretty quotes. Change the ‘s and ’s back to '. --- Simon Welsh Admin of http://simon.geek.nz/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP syntax - novice question
On 30/10/11 at 01:18, si...@welsh.co.nz (Simon J Welsh) wrote: It seems as though your editor has changed the normal quotes around pre into pretty quotes. Change the ‘s and ’s back to '. Hi, Simon. Thanks for that. Couldn’t see for looking... Cheers, Phil. -- Please consider the environment before reading this email... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] create file after form completion
This line is consider 'top post'. Meaning you're posting on top of the reply. On Sat, Oct 29, 2011 at 12:12 PM, Pau vim.u...@googlemail.com wrote: Hi, Please try not to top post. sorry, but I do not understand the expression (I am not native, as you might have guessed). Do you mean not to include the email in my reply? Sorry about that. Where as this line is bottom posting. Meaning you'd be posting bottom/below the reply, which is the preferred method on this list. Regards, Tommy