[PHP] RE: Print or Echo takes lots of time
Hi, Thanks for supporting, because of the approaching to the problem, I don't want to change generate once echo once style. And I found solution like this, I split variable into an array and generate loop for printing, mostly fix the problem. And more interesting, some times problem repeates himself. I believe this was connected to php memory performance. Anyhow is there any information about optimal echo or print size ? Regards Sancar On Wednesday 27 September 2006 01:22, Richard Lynch wrote: > On Mon, September 25, 2006 7:11 am, Sancar Saran wrote: > > When I was check the performance of my system I found interesting > > resuts. > > > > My code stores html output into a variable. When page creation > > complete I > > printed out the variable. > > > > Problem was generation html code takes 0.5 second and just > > echo $strPage takes 2.0 or more second. > > > > my code structure was. > > > > $strPage = " yada dayda"; > > ... > > $strPage.= " another html tags"; > > ... > > $strPage.= getSqlDataAndCreateSomeHtmlCOde(); > > ... > > end of page creation. > > Current Total execution time 0.5 seconds. > > print $strPage; > > Current Total execution time 2.5 seconds. > > > > $strPage carries entire html structure (for example equal of 100K html > > code); > > > > excluding the cookie and other kind of header transfers and error > > messages, > > there was no print or echo command was submitted. > > > > Is there any idea about this latency and any idea to find problem... > > You could try echo-ing it out in "chunks" instead of waiting until the > very end. > > echo/print has to send the data "out" through the very narrow pipe to > Apache -> the browser > > If you send every little snippet one tiny piece at a time, you waste > resources. > > If you wait until the end and send out some huge monster string, you > waste resources. > > Find the balance if you can. > > Depends on your hardware/bandwidth exactly where optimum is. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Print or Echo takes lots of time
On Tue, September 26, 2006 4:08 am, Colin Guthrie wrote: > Google Kreme wrote: >> On 25 Sep 2006, at 06:11 , Sancar Saran wrote: >>> $strPage = " yada dayda"; >>> ... >>> $strPage.= " another html tags"; >>> ... >>> $strPage.= getSqlDataAndCreateSomeHtmlCOde(); >> >> If this is generating hundred of K of HTML, use ' instead of " >> >> (yes, it's faster). > > In this example tho', it is not the string processing that is taking > up > the time. The $ expansion etc. will be done when building the string > $strPage, not at the echo stage which is where the OP is seeing the > delay. Plus it's "faster" in such a marginal sense that you'd have to be doing zillions in a very tight loop to measure it. Benchmark it for yourself and see. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print or Echo takes lots of time
Google Kreme wrote: > On 25 Sep 2006, at 06:11 , Sancar Saran wrote: >> $strPage = " yada dayda"; >> ... >> $strPage.= " another html tags"; >> ... >> $strPage.= getSqlDataAndCreateSomeHtmlCOde(); > > If this is generating hundred of K of HTML, use ' instead of " > > (yes, it's faster). In this example tho', it is not the string processing that is taking up the time. The $ expansion etc. will be done when building the string $strPage, not at the echo stage which is where the OP is seeing the delay. Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print or Echo takes lots of time
Sancar Saran wrote: > Hi, > > When I was check the performance of my system I found interesting resuts. > > My code stores html output into a variable. When page creation complete I > printed out the variable. > > Problem was generation html code takes 0.5 second and just > echo $strPage takes 2.0 or more second. I read a while ago that it is more efficient to echo as you go rather than store up a large variable with the content in it. You may want to investigate output buffering instead as 9 times in 10 the sames results of using a big variable can be achieved. It does seem odd none the less tho' that it takes so long. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print out all the files in a directory
Pooya Eslami schrieb: Hi, I want to write a simple script that looks for all the files with a common name and show them, like all the .mp3 files or all the .doc files. How do I go about it? Thank you, -Pooya Look in the manual at php.net, especially: http://php.net/opendir http://php.net/readdir http://php.net/closedir Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print PHP Code in Color on Dreamweaver MX
Ryan Munevar wrote: Hello, Does anyone know how to actually print PHP code in Color to actual paper from Dreamweaver MX? We like to paste the code up to the wall here to get a bigger look at it. I know you can do it in BBedit, but MX is what we like. Just curios. Thanks! Sincerely, Ryan Munevar Try the function highlight_string. Send the source code you want to your browser and then print your browser's screen. You can even change the colors; check out php.ini's syntax highlighting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print All parameters
This is what I do, to get EVERYTHING: But this will also get all functions and constants.. use only the first command for only the variables.. -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com "Mike Mapsnac" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > Is it possible to print all values of all variables in php file? Including > global, local... > Thanks > > _ > Get a FREE online virus check for your PC here, from McAfee. > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print..
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Daniel Antonio De Lima" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Good Morning I am working with PHP 4.0.6, and I do not obtain to send given of the page for the printer. I use function " PRINTER_OPEN() ", I make the manual in accordance with, exactly thus it gives an error to me of indefinite function. What it can be? Fatal error: Call you undefined function:printer_open() $print = printer_open(); $print = printer_open("LPT1 "); printer_write($print, " Test of printer "); printer_write($print, " Test of printer "); printer_write($print, " Test of printer "); $print = printer_close(); e this error it even gives to me with function " PRINTER_WRITE() ", could give tips of that he can be happening. Yours truly. Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print help
"Ron Allen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What I would like to do is to make an optional page that can print > information to a specified printer. Can PHP do this? > If so how??? > > Please help!!! Look in the manual under 'printer'.. http://www.php.net/manual/en/ref.printer.php Printer functions are server-side and work on Windows operating systems only. - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: print html code
try echo ie... echo "this is a paragraphr\n\"; the r\n\ is a return character and newline character. "Karina S" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I want to make a php site which can generate a html code and display it on > the screen. (Display the code itself.) > I use htmlspecialchars() function. It works fine, but now I have to add > about 200 lines of static html code to print it out. If I put all of the > code in a string than it will appear in a single line. (Maybe it works, but > not nice) > > How can I easy print out more lines of html code with php? > > Thanks! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: print html code
try echo ie... echo "this is a paragraphr\n\"; the r\n\ is a return character and newline character. "Karina S" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I want to make a php site which can generate a html code and display it on > the screen. (Display the code itself.) > I use htmlspecialchars() function. It works fine, but now I have to add > about 200 lines of static html code to print it out. If I put all of the > code in a string than it will appear in a single line. (Maybe it works, but > not nice) > > How can I easy print out more lines of html code with php? > > Thanks! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: print all variables
If you want to see any data beside the form, then you can do this... print_r($GLOBALS); Only if you want to see data beside the submitted form. "Matt Palermo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Could anyone tell me how to print all the variables and values from a submitted form, so that I can check them? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: print all variables
Depending on Form Method (example uses POST METHOD) echo ""; print_r($HTTP_POST_VARS); echo ""; "Matt Palermo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Could anyone tell me how to print all the variables and values from a submitted form, so that I can check them? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Print bgcolors in table
At 10:55 16.12.2002, Bogdan Stancescu said: [snip] >As far as I can see, this is not even an HTML question - it's more of a >user agent question. [snip] Actually the user agent has the final authority on how documents look like. For example, in Internet Explorer, you may go to Extras/Options/Advanced and specify to print (or not) background colors or images. In Netscape this option exists in the preferences dialog. There's no way for the page to override the agents settings. -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print bgcolors in table
As far as I can see, this is not even an HTML question - it's more of a user agent question. Lars Espelid wrote: Hello, I have been looking for a newsgroup where I can post questions about css/html. I did not find any. Any suggestions? If you want a break from php, my problem is as follows: Have got a table in html with different background colors on the rows. When I print the page to my printer, the colors won't show. I have tried to specify output media, but it won't work. Tried f.ex. this: in print.css: @media print { TR.graaOver { BACKGROUND-COLOR: #E5E5E5; } } in report.html: . .. thanks, Lars -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: print to file
Thank you! I feel like an idiot, kept getting it mixed up with perl. :) Bryan On Tue, 3 Dec 2002, Thomas Seifert wrote: | |$fp=fopen("filename","a"); |fputs($fp,"text to the file"); |fclose($fp); | | |Regards, | |Thomas | |On Mon, 2 Dec 2002 15:52:23 -0800 (PST) [EMAIL PROTECTED] (Bryan Koschmann - Gkt) |wrote: | |> Okay, this is probably stupid, but how do you print to a file? |> |> Thanks, |> |> Bryan |> | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: print to file
$fp=fopen("filename","a"); fputs($fp,"text to the file"); fclose($fp); Regards, Thomas On Mon, 2 Dec 2002 15:52:23 -0800 (PST) [EMAIL PROTECTED] (Bryan Koschmann - Gkt) wrote: > Okay, this is probably stupid, but how do you print to a file? > > Thanks, > > Bryan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print Question
I wasn't in the office hence haven't visited this group for a while... Here's an idea though I still may not understand the whole situation but from what I think it is here goes: I guess you will have to mix javascript and php in the following manner... use onclick for a particular HTML variable and create a function in Java Script that runs when you click this and returns true or writes to an HTML variable say input type= hidden name=hasClicked value=false... the HTML value will give this hidden variable the value true when clicked otherwise it will be defaulted at false... You can use document.write.formName.hasClicked.value = true... Then continue with: if($hasClicked == "true") Run the Script... This will mean your script won't run until OK is pressed... I hope this helps and I hope its not too late... Spike... "Chris Kay" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... Question I have is I want to run a print job of 200+ invoices I have a javascript code to open a print dialog box and Then go to next invoice and do the loop.. Problem I am having is that I want it to pause if the ok button on the dialog Box is not pressed.. When I run the script it fly's throught and brings up a heap of printer Dialog boxes which causes me to ctrl+alt+del... Anyway or pausing the script untill ok is pressed? Thanks in advance.. --- Chris Kay Technical Support - Techex Communications Website: www.techex.com.au Email: [EMAIL PROTECTED] Telephone: 1300 88 111 2 - Fax: (02) 9970 5788 Address: Suite 13, 5 Vuko Place, Warriewood, NSW 2102 Platinum Channel Partner of the Year - Request DSL - Broadband for Business --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print Question
>Question I have is > >I want to run a print job of 200+ invoices > >I have a javascript code to open a print dialog box and >Then go to next invoice and do the loop.. > >Problem I am having is that I want it to pause if the ok button on the >dialog >Box is not pressed.. > >When I run the script it fly's throught and brings up a heap of printer >Dialog boxes which causes me to ctrl+alt+del... > >Anyway or pausing the script untill ok is pressed? I doubt it... And you're real unlikely to find the answer on a PHP mailing list, as noted. Some things you might consider. Use PHP to concatenate all the invoices with a "new page" character (control-L, I think) between them. That's probably only gonna work on an old dot-matrix printer, though... Use PHP to shove all the invoices into a single PDF http://php.net/pdf Use PHP to shove all the invoices into some kind of word-processing program format with page breaks between them. I imagine that if they are simple enough, you could even do a sample MS Word and reverse-engineer the format of the document enough to get it right. Use PHP to spew out the invoices in tab-delimited format, one per row, and download that, and then use Word's "template" or "mail-merge" or whatever they called it to print them up. Oh, I suppose you could use JavaScript with some kind of timer loop so I can click on the "Ok" button as fast as you pop up the stupid windows, but do you really expect me to click 200+ times for your stupid print button to work? Isn't it weird how all my good answers started with "Use PHP?" :-) :-) :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: print on top
Hi Jule, You need to sort your records with "ORDER BY" clause . I don't know what your table looks like and obviously don't know if you have suitable columd for it.. Say you have a newsid field defined with int datatype with auto_increment property, then you can issue your statement as "SELECT .. FROM table ORDER BY newsid DESC" to make the last inserted row at the very top. Likewise, if you have a inserted date/time column to keep track of the times that news are inserted , it may be used for the same purpose as well. Gurhan -Original Message- From: Jule Slootbeek [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 6:39 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: print on top Hey guys and gals, I'm writing this script for my new webpage, and i'm using MySQL to read and add news articles to a page, but everytime i add a new article it puts it under the older one, how can i get it on top? thanks Jule $Link = mysql_connect ($Host, $User, $Password); $Query = "SELECT * from $TableName"; $Result = mysql_db_query ($DBName, $Query, $Link); while ($Array = mysql_fetch_array ($Result)) { print (""); print ("\n"); print ("$Array[header]\n"); print ("\n"); print ("\n"); print ("$Array[article]\n"); print ("\n"); print ("\n"); print ("Posted by: $Array[name] on $Array[postdate]\n"); print ("\n"); print (""); -- Jule Slootbeek [EMAIL PROTECTED] http://blindtheory.cjb.net - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Print ONCE ONLY?????
I think this is actually the problem The first time you do $row = mysql_fetch_array($result); it reads the first row. Then you don't do anything with that data, but move on to the next one right away in the while: while ($row = mysql_fetch_array($result)) and only then you print out the data. So you are always skipping the first record. Sincerely, Pavel Kharitonov Project Manager Intechnic Corporation http://www.intechnic.com Phone: (847) 816-1231 -Original Message- From: Michael Kimsal [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 12, 2002 5:14 PM To: Dani Cc: PHP LIST Subject: [PHP] Re: Print ONCE ONLY? Dani wrote: > Hi Again! > > Why does this print only one record? > > 1. I have checked on the table on MYSQL and I have 2 records with this > data. > 2. Can I actually use the word "and" twice or three times for filtering > the data that I need during query?? (example: $query = "select * from > main_table where item_type = 'hotel' and class = 'melati' and price = > '200' and facilities = 'swimming pool' " > #2 - yes. that's what SQL is all about... #1 - Why do the $row=, then also do it in a while loop? Why not just do it in a while loop? I'm not sure that'd necessarily help in this case (most likely won't) but it would certainly be less typing in the future. Are you postive 2 rows match the 'hotel' and 'melati'? > Could some body help please??? > > here is my code > > ... > $query = "select * from main_table where item_type = 'hotel' and class = > 'melati'"; > $result = mysql_query($query); > $row = mysql_fetch_array($result); > echo "$row[item_id]",""; > while ($row = mysql_fetch_array($result)) > { > echo "WHILE RESULT","$row[item_type]","","$row[class]"; > } > Michael Kimsal PHP Training Courses http://www.tapinternet.com/php/ 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Print ONCE ONLY?????
Dani wrote: > Hi Again! > > Why does this print only one record? > > 1. I have checked on the table on MYSQL and I have 2 records with this > data. > 2. Can I actually use the word "and" twice or three times for filtering > the data that I need during query?? (example: $query = "select * from > main_table where item_type = 'hotel' and class = 'melati' and price = > '200' and facilities = 'swimming pool' " > #2 - yes. that's what SQL is all about... #1 - Why do the $row=, then also do it in a while loop? Why not just do it in a while loop? I'm not sure that'd necessarily help in this case (most likely won't) but it would certainly be less typing in the future. Are you postive 2 rows match the 'hotel' and 'melati'? > Could some body help please??? > > here is my code > > ... > $query = "select * from main_table where item_type = 'hotel' and class = > 'melati'"; > $result = mysql_query($query); > $row = mysql_fetch_array($result); > echo "$row[item_id]",""; > while ($row = mysql_fetch_array($result)) > { > echo "WHILE RESULT","$row[item_type]","","$row[class]"; > } > Michael Kimsal PHP Training Courses http://www.tapinternet.com/php/ 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: print on printer
javascript javascript = client side php = server side unless you want to print on a printer on the server, your goign to need to use javascript. not only are you asking in the wrong forum, real answer is 'I dont know' sorry cant help ya bud. -- Chris Lee [EMAIL PROTECTED] "Luz Lopez" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi All > > I have a php that access to database and show the values in the browser, But > I need add hte option of print on printer, but that only print the table > with values. > > Somebody can help me? > > Thanks in Advanced, > > Regards, > > > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Print statements , syntax , usage, etc
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Ricardo Fitzgerald) wrote: > *print 'Ref:';* > *print '$reference';* > > the problem is with the output, the table is fine but the variable $reference > otputs it's name $reference instead of it's value i.e. 345. I'm getting mad > because I know this has to be some kind of syntax error but I tried > exchanging quotes for double quotes, adding parenthesis and stuff like that > and I couldn't figure out what the prob is ... Re-try the double quotes. Variable expansion is available within double quotes. It is not within single quotes. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Print out the form When click Submit?
if there were, webmasters could take control over your printer using their website. what a horrible thought! you can start a "request for print" however, simply by adding : this will open a print window... Hope that helps, Raphael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]