RE: [PHP] More info on timeout problem
-Original Message- From: Instruct ICC [mailto:[EMAIL PROTECTED] Sent: Monday, November 05, 2007 3:34 PM To: php-general@lists.php.net Subject: RE: [PHP] More info on timeout problem Sounds much like what I'm trying to do. I have had to give up, for the time being, on using PHP to upload the datafile; it's about 56 MB in size and nothing I do seems to let me upload anything larger than a 2MB file. :( I don't know if it's been mentioned in this thread, but 2M is a default setting for upload_max_filesize http://php.he.net/manual/en/ini.core.php You may also need to adjust post_max_size and memory_limit. My upload_max_filesize is at 5M,, post_max_size at 8M, and memory_limit is at 32M. From the docs: post_max_size integer Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. , and then checking if $_GET['processed'] is set. I'm jumping in here late, so I haven't seen previous posts. Another possible place I have seen limiting post/upload sizes: There is an Apache directive called LimitRequestSize or somesuch which will take precedence (silently) over any PHP max post size you set. I found this set once before in an apache_root/conf.d/php.conf file that I eventually found. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting mysql_query results into an array
-Original Message- From: Bill Guion [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 14, 2007 12:35 PM To: PHP-General Subject: Re: [PHP] Getting mysql_query results into an array At 6:22 PM -0600 2/13/07, Richard Lynch wrote: The most efficient way is Don't do that. :-) Simply loop through the results and do whatever you want to do with them, and don't put them into an array at all. This question has appeared before, and usually breaks down to one of these scenarios: #1 snip 1 #2 snip 2 #2 does occasionally have an exception to the rule, where the SQL query is nasty and the PHP is fast and easy, but that's awfully rare. How about scenario #3: I wish to output my data in (for example) three columns, as a phone book does. To make the example simple, assume 15 data points. I wish the output to look like 1 611 2 712 3 813 4 914 5 1015 So when I'm outputting row 1, I need data points 1, 6, and 11. Isn't it easier to generate the query, put in array, and output the rows from the array? Keep in mind, the number of data points might be variable, the constraints being n columns with approximately the same number of data point in each column. Instead of creating a whole array, why not just move the pointer of the result set? Like so (the example prints rows in reverse order): http://us3.php.net/manual/en/function.mysql-data-seek.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How php works?
-Original Message- From: Larry Garfield [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 19, 2006 10:26 AM To: php-general@lists.php.net Subject: Re: [PHP] How php works? On Tuesday 19 December 2006 02:12, Robert Cummings wrote: Is that why the PHP License is non-GPL compatible, or is there a different reason for that? (That's always bugged me, personally.) PHP and license has less restrictions... it is not viral. You can for the most part do as you please with the code. That's nice. It's also not what I asked. I asked what it was that made it GPL-incompatible. He did answer the question. The PHP License doesn't enforce many restrictions on what you can do with the code. For example, you could modify it (or not) and sell it without the source if you follow the restrictions in the license. The GPL specifically doesn't allow that of course, so that's why they are incompatible. http://www.fsf.org/licensing/licenses/index_html#GPLIncompatibleLicenses -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php and DB2
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, December 08, 2006 3:39 PM To: php-general@lists.php.net Subject: [PHP] php and DB2 hi to all, my IT director got an idea to replace mysql with DB2. more power/flexibility/stability/security... though, for our needs, I think mysql is just fine and enough. the business we are doing is promotional products and all online orders we have are ONLY from our sales people. with 200-300 orders per day and averge of 5 items per order I think we really don't need that replacement. though, don't know how php works with DB2 (assuming same quality as with mysql). can anybody give me some ideas and reasons to present to boss to NOT replace mysql with DB2? thanks. -afan I don't know how close the syntax between MySQL and DB2 is, but I suspect you're looking at quite a bit of rewrite. Unless your application was written specifically to work with either, I doubt it will simply be a matter of plugging in a new database. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] backing up a database
-Original Message- From: James Tu [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 28, 2006 5:03 PM To: PHP General List Subject: Re: [PHP] backing up a database Thanks Brad: I'm just surprised that when people mention mysqldump, most of the time they don't talk about locking the tables at all. I'm curious why this is the case. -James Unless you tell mysqldump not to lock tables, or change the defaults, it automatically locks: For example, use of --opt is the same as specifying --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset. Note that as of MySQL 4.1, all of the options that --opt stands for also are on by default because --opt is on by default. http://dev.mysql.com/doc/refman/4.1/en/mysqldump.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP causing seg fault
-Original Message- From: Glenn Richmond [mailto:[EMAIL PROTECTED] Sent: Thursday, October 12, 2006 4:45 AM To: php-general@lists.php.net Subject: [PHP] PHP causing seg fault Hi guys, I'm attempting to run a SugarCRM variant that uses SOAP to access information from the database. The code is causing a seg fault when executing a particular line of code. The code executes properly until it calls a generic function in the parent class that causes a seg fault on the return command. The line of code is: return $this; I've found this to be a problem in PHP version 5.1.4 and 5.2.0rc4. Is this statement illegal in PHP5? When I set a memory limit for the script, the error changes to indicating that it has exceeded its memory allocation, so it seems to be allocating memory over and over. Note that this code runs fine on most other combinations of functions calling this same parent method. Any suggestions are appreciated. This sounds a lot like what I was running into. What is the OS? I was having a very similar-sounding problem running SugarCRM on any Red Hat system (including CentOS and Fedora). kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Disable all caching
-Original Message- From: Brad Fuller [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 12:55 PM To: php-general@lists.php.net Subject: RE: [PHP] Disable all caching I have a php (ver 4.x) script that is being cached. I have placed: META HTTP-EQUIV=CACHE-CONTROL CONTENT=NO-CACHE but the page is still being cached. I'm not sure if its apache or the php. How can I disable all caching? is there something I can set in php.ini? (Mac OS X Server) Thanks Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try adding this to your php page code if(!strpos(strtolower($_SERVER[HTTP_USER_AGENT]), msie) === FALSE) { header(HTTP/1.x 205 OK); } else { header(HTTP/1.x 200 OK); } header(Pragma: no-cache); header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); header(Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); header(Cache-Control: no-cache, cachehack=.time()); header(Cache-Control: no-store, must-revalidate); header(Cache-Control: post-check=-1, pre-check=-1, false); I've seen a lot of people do this, so I have to comment. The last Cache-Control header REPLACES any other Cache-Control headers set previously unless you specify not to. http://us2.php.net/manual/en/function.header.php The header Cache-Control: no-cache, cachehack=time() will never be sent because the second one replaces it. The third one uses the second argument to specify that it should not replace the existing one. Of those three Cache-Control lines, only two will even be sent to the browser. Cache-Control: no-store, must-revalidate Cache-Control: post-check=-1, pre-check=-1 kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE:[PHP] Client Computer Registration
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 03, 2006 2:10 PM To: Wesley Acheson Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] RE:[PHP] Client Computer Registration On Tue, October 3, 2006 2:33 am, Wesley Acheson wrote: They could also be doing something like giving the client an SSH key to download, I've heard of this situation in a bank before. Is the key tied to my hardware? At least that stops the virus/Trojan scenario. But not the petty thief who breaks in and takes my computer, and oh look, now I have his bank account too! Sweet!!! Puhleeze! Do you really want to bank with a place that does this? The registration doesn't replace a login with a username/ID and password. https://www.key.com/html/obi_security.html From what I understand, I'd be in no more trouble if someone stole my computer today than if someone stole it after my bank implemented this registration method. I'm still required to provide a correct ID/password combination. I just can't login from an unknown computer without providing additional information. Or am I missing something? kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calculations
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 27, 2006 2:11 PM To: php-general@lists.php.net Subject: Re: [PHP] Calculations When my level of free time matches my level of curiousity, I'll have to research it further. For now, I'm ok with not knowing unless someone posts the answer here. hah -TG Lucky day. ;) http://www.php.net/manual/en/language.operators.bitwise.php kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Stream download problem
-Original Message- From: Michael Satterwhite [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 20, 2006 8:32 PM To: PHP Users Subject: [PHP] Stream download problem I have a site that generates a file to be streamed down. The relevant code is: -- header(Content-type: application/vnd.ms-excel); header(Content-disposition: attachment; filename=$EXPORT_TIME.txt); header(Content-disposition: attachment); You're overwritting the Content-disposition header with one that doesn't supply a suggested filename. The first Content-disposition header is not being sent at all, so IE is guessing at a filename. Take a look at the headers your browser is receiving. You'll probably find that's what's going on. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Stream download problem
-Original Message- From: Michael Satterwhite [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 12:11 PM To: Kristen G. Thorson Subject: Re: [PHP] Stream download problem Kristen G. Thorson wrote: -Original Message- From: Michael Satterwhite [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 20, 2006 8:32 PM To: PHP Users Subject: [PHP] Stream download problem I have a site that generates a file to be streamed down. The relevant code is: -- header(Content-type: application/vnd.ms-excel); header(Content-disposition: attachment; filename=$EXPORT_TIME.txt); header(Content-disposition: attachment); You're overwritting the Content-disposition header with one that doesn't supply a suggested filename. The first Content-disposition header is not being sent at all, so IE is guessing at a filename. Take a look at the headers your browser is receiving. You'll probably find that's what's going on. I must be missing something. The line header(Content-disposition: attachment; filename=$EXPORT_TIME.txt); *IS* supplying the suggested filename. $EXPORT_TIME had been created earlier in the script - but even .txt would have been a legal (albeit dumb and unintended) filename - hidden in real OS's, but it's legal. Where is the filename being omitted? I appreciate the help. You're overwriting that line with: header(Content-disposition: attachment); http://us2.php.net/manual/en/function.header.php By default, if you supply two headers of the same type, you're overwriting the first with the last (see the second parameter of header()). I don't know if there's configure setting that changes that behavior, but if I run your code on my server, the ONLY Content-disposition header I get is: Content-disposition: attachment I do not get the other one that sets the filename. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: File Download Headers
-Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED] Sent: Friday, June 16, 2006 9:11 AM To: tedd Cc: [EMAIL PROTECTED]; Barry; php-general@lists.php.net Subject: Re: [PHP] Re: File Download Headers tedd wrote: Barry says you can use these three: header(Content-Type: application/force-download); header(Content-Type: application/octet-stream); header(Content-Type: application/download); Richard says only use this one: header(Content-type: application/octet-stream); And, you say use both. Both Content-Type and Content-Disposition. Richard's example is the correct Content-Type to use. Barry's is no different than this: header('Content-Type: foo/bar'); It's better to use a valid type and to not have superfluous header() calls that do nothing. Hope that helps. Chris When you have three lines setting the same header, you're just replacing one with the other anyways: header(Content-Type: application/force-download); header(Content-Type: application/octet-stream); header(Content-Type: application/download); The actual header being sent for Content-Type in this case is application/download. The first two are not sent unless you remember to use the second parameter of header(). http://us2.php.net/manual/en/function.header.php kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP JavaScript
-Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Friday, May 19, 2006 10:34 AM To: php-general@lists.php.net Subject: [PHP] PHP JavaScript input type=checkbox name=list37[] value=7 / Suddenly JavaScript doesn't care for the object and throws an error (take the brackets out and it works fine for JS, but PHP cannot see all of the values). I have Googled for this but think that my search term(s) are failing me because the condition is hard to describe. Would someone please point me in the right direction? I ran into this problem once too and had a terrible time finding an answer. I started finding some stuff with the following search terms: php checkbox array javascript entity reference Which brought up a page in the manual. It had two helpful notes: http://us2.php.net/variables.external kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] String is not zero-terminated
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, April 10, 2006 4:44 PM To: php-general@lists.php.net Subject: [PHP] String is not zero-terminated In order to attempt to figure out why my script segfaults PHP (5.0.4, 5.1.2, 5.1.3RC3) I've been compiling --with-debug That then gives me warnings such as: Run-time warning. String is not zero-terminated (ÿØÿà) (source: /www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45) in /www/acousticdemo.com/web/info.com/overture/overture.inc:128 Run-time warning. String is not zero-terminated (ÿØÿà) (source: /www/acousticdemo.com/php_cvs/php5.1-200604071630/Zend/zend_variables.h:45) in /www/acousticdemo.com/web/info.com/overture/ocr.inc:59 Did you see this? http://mail-archives.apache.org/mod_mbox/perl-docs-dev/200309.mbox/[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limitation on PEAR : Spreadsheet_Excel_Writer
-Original Message- From: Bagus Nugroho [mailto:[EMAIL PROTECTED] Sent: Thursday, February 09, 2006 5:48 PM To: php-general Subject: [PHP] Limitation on PEAR : Spreadsheet_Excel_Writer Hello Everyone, I'm succesfully generate report from mysql table using PEAR : Spreadsheet_Excel_Writer, but I have problem to generate from table which contain long text, the text is not download completely. such as blablabla. it only contain blab How can manipulate PEAR, to get full text on excel sheet. Thanks in advance Bgs MySQL fields can contain 65535 characters. Excel fields can only hold 32767 characters. If you have any text fields longer than 32767 characters, then they will be truncated by Excel. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC question
Jeremy Schreckhise wrote: I have an Openlink Single Tier Driver on an XP pro machine with windows installed on drive f: because I have a dual boot with Red Hat. Database is Progress 8.3c on a SCO Unixware 7.1.4 Dell Server. I can connect to all progress databases and pull data utilizing a System DSN via Openlink, however when I try to connect via PHP I get the following error: Warning: odbc_connect(): SQL error: [OpenLink][ODBC]Unable to allocate server handle, SQL state S1000 in SQLConnect Any suggestions? I know the code is fine, because it works on another box with a similar set up, but with windows installed on drive c: Thanks in advance, Jeremy Schreckhise I did a search on that error + OpenLink and came up with this: http://support.openlinksw.com/support/print_opie_article.vsp?OP_ID=299 I did this once a long time ago (PHP/ODBC/Progress), but I don't see that error in my notes. The only thing I can offer is that I had trouble making sure the proper Progress environment variables ($DLC and the like) were set and accessible to PHP/Apache. If that doesn't help, try the OpenLink people. I had to place a support request with them before, and they were pretty helpful. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex to wrap a href= tag around a p tag
Shaun wrote: Hi M, Thanks for your help, the code works fine except if there is a line break in the html, for example this works ptest/p But this doesnt ptest /p Any ideas? See the last user contributed note from *csaba at alum dot mit dot edu *at http://us3.php.net/manual/en/reference.pcre.pattern.modifiers.php, particularly the last paragraph. He gives a very good explanation of pattern modifiers that answers your question. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script won't work on other server
Peppy wrote: This info is for the server where the script does not work: Apache/1.3.33 (Unix) PHP/4.3.10 FreeBSD cliffb55.iserver.net 4.7-RELEASE-p28 FreeBSD 4.7-RELEASE-p28 #42: Tu i386 This info is for the server where the script works: Apache/2.0.40 (Red Hat Linux) PHP Version 4.3.2 Linux pl1.qcinet.net 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 Thanks for your help. Original Message Date: Wednesday, November 30, 2005 02:15:47 PM -0600 From: Peppy [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] script won't work on other server I have a small script that I am testing out on two different servers. It uses the $_SERVER['HTTP_USER_AGENT'] to detect the browser and serve up a style sheet dependent on the results. (Please don't comment on its usefulness, it's just an example.) On one server, I can get this script to run correctly in all browsers that I test. On another server, it will not run correctly in Netscape (testing for the word Gecko, but have used Netscape also). Any help would be appreciated. Link to script: http://www.asrm.org/class/php/angelia.php In case it's needed, link to file with phpinfo(): http://www.asrm.org/test/test.php Using Netscape to view this page: http://www.asrm.org/class/php/angelia.php My stylesheet link is: link rel='stylesheet' type='text/css' href='net.css' / Looks like it works for me. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrading on RH ES3
Jeff McKeon wrote: I've got a server with RedHat ES3 running. It has PHP 4.3.2 installed but for an application I want to install I need a min of 4.3.9. This server also runs apache2.0. I can't find RPMs for RH ES3 so I downloaded the source for PHP4.4.1 figuring I would just compile myself. Problem is, the INSTALL file gives instructions based on the idea that you don't already have Apache2 or an earlier ver of PHP Installed already. Since Apache2 was installed via RPM originally the INSTALL instruction for PHP with Apache2 prob won't work. ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql It's the: --with-apxs2=/usr/local/apache2/bin/apxs Switch that has got me scratching my head. /usr/local/apache2/ doesn't exist and I can't find apxs anywhere on the sys. Can I just configure with ./configure --with-mysql?? Thanks, Jeff I believe you need the httpd-devel rpm to get apxs2. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_match_all for dummies
I am a regex retard. I am trying to pull keywords out of this crazy bbcode-like file, but only for bbcode-like code NOT enclosed in HTML comments. I currently have managed to create this regex: '/(?!!--)\[!(\w+)::.*!\](?!--)/U' Which matches [!keyword::crazy bbcode!] and not !--[!keyword::crazy bbcode!]-- That's a step in the right direction. But it includes in the match keywords within phrases like this: !-- A sentence including some [!keyword::crazy bbcode!]. -- I want to ignore all bbcode within HTML quotes. How do I do this? thanks kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cookie problem with IE
n.g. wrote: save below as testcookie.php, request it from your browser twice, what do you get at 2nd time? ?php setcookie('sessioncookie', 1); setcookie('storedcookie',1,time()+3600); var_dump($_COOKIE); ? On 11/22/05, Kristen G. Thorson [EMAIL PROTECTED] wrote: Anyone have any suggestions? I'm still stuck. thanks, kgt Kristen G. Thorson wrote: I'm having problems with a customer who can't login to a wholesaler application. To ensure the problem was that the cookie was not being set, I sent him to this script: if( !isset( $_REQUEST['page'] ) ) { setcookie('VATtest','Cookie has been set.',time()+5, /); echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a'; } else if( $_REQUEST['page'] == '1' ) { if( isset( $_COOKIE['VATtest'] ) ) { echo $_COOKIE['VATtest']; } else { echo 'Cookie NOT set.'; } } ? He got Cookie NOT set. which means exactly what it says. He's using IE 6.0, and swears up and down that he's set it to always allow cookies from this domain. I can't verify that he's set it correctly, but he has been told twice how to do it. I also know his browser must be saving some cookies, as he is able to login to other sites. Has anyone run into other sources of cookie-blockage in the past? I cannot manage to duplicate this when I have IE set to always allow cookies from this domain. Thanks for any tips, kgt Request from MY browser? I get array(2) { [sessioncookie]= string(1) 1 [storedcookie]= string(1) 1 } This isn't a problem in my browser, however. I don't want to keep sending this customer to random scripts, so can you explain the point of this script? I mean, in what way might this help me figure out why his browser is not setting a cookie? thanks, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie problem with IE
Jay Blanchard wrote: But I sure would like to see the URL once he has clicked it. Have you tried changing to $_GET['page']? Again, all of this is just for gigglesbut there is likely to be a clue. On privacy policies in IE (can he try another browser?) what is his setting? I'm still waiting on definitive word as to what exactly his privacy settings are. In my experiments, manually setting IE to Always Allow or Always Block cookies for a domain will completely override privacy settings. I've had IE privacy set to allow no cookies, and manually added the domain to Always Allow and this overrode the no cookies setting. For kicks and giggles, I changed $_REQUEST to $_GET, but he reported no difference. Again, I don't see this as being the problem, since if it were so, he'd get no output at all instead of Cookie NOT set. I'm quite convinced this is a matter of his cookie simply not being set. He is not able to ever see a cookie for this domain in his temp internet files folder, though he tells us there are other cookies there. I wish I could tell him to just use another friggin browser, but it would be nice to fix it so he can use the one he wants, no matter what words one can say about his choice. ;) I have not looked into it, but do some internet security apps like Norton try to block certain cookies? I've not come across this, as I don't really use those programs, but right now I'm grasping for straws. thanks for the help so far, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookie problem with IE
Anyone have any suggestions? I'm still stuck. thanks, kgt Kristen G. Thorson wrote: I'm having problems with a customer who can't login to a wholesaler application. To ensure the problem was that the cookie was not being set, I sent him to this script: if( !isset( $_REQUEST['page'] ) ) { setcookie('VATtest','Cookie has been set.',time()+5, /); echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a'; } else if( $_REQUEST['page'] == '1' ) { if( isset( $_COOKIE['VATtest'] ) ) { echo $_COOKIE['VATtest']; } else { echo 'Cookie NOT set.'; } } ? He got Cookie NOT set. which means exactly what it says. He's using IE 6.0, and swears up and down that he's set it to always allow cookies from this domain. I can't verify that he's set it correctly, but he has been told twice how to do it. I also know his browser must be saving some cookies, as he is able to login to other sites. Has anyone run into other sources of cookie-blockage in the past? I cannot manage to duplicate this when I have IE set to always allow cookies from this domain. Thanks for any tips, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie problem with IE
Jay Blanchard wrote: [snip] Anyone have any suggestions? I'm still stuck. [/snip] Can you send him another test where a basic cookie gets set and then checked? . Not sure what you mean. I sent him to this script: ?php if( !isset( $_REQUEST['page'] ) ) { setcookie('VATtest','Cookie has been set.',time()+5, /); echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a'; } else if( $_REQUEST['page'] == '1' ) { if( isset( $_COOKIE['VATtest'] ) ) { echo $_COOKIE['VATtest']; } else { echo 'Cookie NOT set.'; } } ? Which is all I had in entirety. Is this not a basic cookie? thanks, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookie problem with IE
Jay Blanchard wrote: [snip] Not sure what you mean. I sent him to this script: ?php if( !isset( $_REQUEST['page'] ) ) { setcookie('VATtest','Cookie has been set.',time()+5, /); echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a'; } else if( $_REQUEST['page'] == '1' ) { if( isset( $_COOKIE['VATtest'] ) ) { echo $_COOKIE['VATtest']; } else { echo 'Cookie NOT set.'; } } ? Which is all I had in entirety. Is this not a basic cookie? [/snip] Sorry, I should have paid more attention. Is $_REQUEST['page'] correctly set when (print_r the array...just for giggles) . I can verify $_REQUEST is correct for me, and I'm sure it's correct for him too, since he gets Cookie NOT set. The second if statement requires $_REQUEST['page'] to be 1 to even get to that line. If $_REQUEST['page'] is not set, he should get no output at all. I've been looking through the comments in the manual, and several people mention privacy policies creating a problem in IE. My problem is none of this can be duplicated on my machine (or any other so far), and this customer is in Florida and I'm in Virginia. I've also never seen in other applications that a privacy policy truly needed to be sent to allow a cookie to be set, and apparently the web site manager settings (where you explicitly allow or block cookies from certain domains) override all privacy settings in IE anyways. So that seems like a dead end. thanks, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookie problem
I'm having problems with a customer who can't login to a wholesaler application. To ensure the problem was that the cookie was not being set, I sent him to this script: if( !isset( $_REQUEST['page'] ) ) { setcookie('VATtest','Cookie has been set.',time()+5, /); echo 'a href='.$_SERVER['PHP_SELF'].'?page=1Test cookie./a'; } else if( $_REQUEST['page'] == '1' ) { if( isset( $_COOKIE['VATtest'] ) ) { echo $_COOKIE['VATtest']; } else { echo 'Cookie NOT set.'; } } ? He got Cookie NOT set. which means exactly what it says. He's using IE 6.0, and swears up and down that he's set it to always allow cookies from this domain. I can't verify that he's set it correctly, but he has been told twice how to do it. I also know his browser must be saving some cookies, as he is able to login to other sites. Has anyone run into other sources of cookie-blockage in the past? I cannot manage to duplicate this when I have IE set to always allow cookies from this domain. Thanks for any tips, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PROGRESS SQL_CUR_USE_ODBC
cybermalandro cybermalandro wrote: I am connecting to a PROGRESS DB through the MERANT ODBC driver, When I have the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return nothing but if I have the 4th parameter as lower case it returns my query results but with a PHP error complainning *Notice*: Use of undefined constant sql_cur_use_odbc - assumed 'sql_cur_use_odbc' Wtf? I don't get it, most of the documentation from people connecting to PROGRESS do have the 4th parameter uppercase can someone help me out ? Thanks! Using PEAR:DB with this dsn I can connect and get results: $dsn = odbc(Progress_SQL92_Driver)://$username:[EMAIL PROTECTED]:$port/$database?cursor=SQL_CUR_USE_ODBC; kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PROGRESS SQL_CUR_USE_ODBC
cybermalandro cybermalandro wrote: Thanks for your prompt response! Are you using the pear DB class requiring odbc? I am not very familiar with this class and pear. I was trying to do it the old way. Perhaps you can give me some more examples? I really appreciate your help. Thanks On 10/4/05, *Kristen G. Thorson* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: cybermalandro cybermalandro wrote: I am connecting to a PROGRESS DB through the MERANT ODBC driver, When I have the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return nothing but if I have the 4th parameter as lower case it returns my query results but with a PHP error complainning *Notice*: Use of undefined constant sql_cur_use_odbc - assumed 'sql_cur_use_odbc' Wtf? I don't get it, most of the documentation from people connecting to PROGRESS do have the 4th parameter uppercase can someone help me out ? Thanks! Using PEAR:DB with this dsn I can connect and get results: $dsn = odbc(Progress_SQL92_Driver)://$username:[EMAIL PROTECTED]:$port/$database?cursor=SQL_CUR_USE_ODBC; kgt I think I was using iODBC and the PEAR DB class. I actually did this a long time ago. I have this script sitting on my hard drive and I know I had a working solution at one point in time, so I'm assuming this was it. I don't have the test environment set up anymore, so I can't really check. Following is the script I have to print the contents of the Customer table in the Sports database. It looks like I took a PEAR:DB example and just modified it to work with Progress, so I'm certain there's much room for improvement. require_once '/usr/share/pear/DB.php'; // Get the connection variables: require_once 'dbinfo.php'; $dsn = odbc(Progress_SQL92_Driver)://$username:[EMAIL PROTECTED]:$port/$database?cursor=SQL_CUR_USE_ODBC; // Creates a database connection object in $db or, a database error object if it went wrong. // The boolean specifies this is a persistent connection like mysql_pconnect(), it // defaults to FALSE. $db = DB::connect($dsn, TRUE); // Check whether the object is a connection or if (DB::isError($db)) { /* * This is not what you would really want to do in * your program. It merely demonstrates what kinds * of data you can get back from error objects. */ echo 'Standard Message: ' . $db-getMessage() . br\n; echo 'Standard Code: ' . $db-getCode() . br\n; echo 'DBMS/User Message: ' . $db-getUserInfo() . br\n; echo 'DBMS/Debug Message: ' . $db-getDebugInfo() . br\n; exit; // an error. //die($db-getMessage()); // Print out a message and exit if it's // an error object. } // Get a connection as above $sql = SELECT * from PUB.Customer; // Build your SQL query $res = $db-query($sql); if (DB::isError($res)) {// Check the result object in case there die($res-getMessage());// was an error, and handle it here. } echo table cellpadding=0 cellspacing=0 border=0; echo trthCust Num/th; echo thName/th; echo thAddress/th; echo thAddress2/th; echo thCity/th; echo thState/th; echo thCountry/th; echo thPhone/th; echo thContact/th; echo thSales-Rep/th; echo thComments/th; echo thCredit-Limit/th; echo thBalance/th; echo thTerms/th; echo thDiscount/th; echo thPostal-Code/th/tr; while ($row = $res-fetchRow(DB_FETCHMODE_ASSOC)) { // Fetch a row from the result resource object $res. // DB_FETCHMODE_OBJECT returns a row with column names as keys. // Other possibilities are listed here: // http://pear.php.net/manual/en/core.db.tut_fetch.php if (DB::isError($row)) { //fetchRow can return an error object like most PEAR::DB methods die($row-getMessage()); } else { echo trtd . $row[Cust-Num] . /td\n; echo td . $row[Name] . /td\n; echo td . $row[Address] . /td\n; echo td . $row[Address2] . /td\n; echo td . $row[City] . /td\n; echo td . $row[State] . /td\n; echo td . $row[Country] . /td\n; echo td . $row[Phone] . /td\n; echo td . $row[Contact] . /td\n; echo td . $row[Sales-Rep] . /td\n; echo td . $row[Comments] . /td\n; echo td . $row[Credit-Limit] . /td\n; echo td . $row[Balance] . /td\n; echo td . $row[Terms] . /td\n; echo td . $row[Discount] . /td\n; echo td . $row[Postal-Code] . /td/tr\n; } } echo /table; $res-free(); $db-disconnect(); // Close the connection. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql/php date functions..
Read up on mysql date types and functions. You can convert a unix timestamp to a mysql date with the FROM_UNIXTIME() function. If you want to store as unix timestamp, store it in an int field. To use mysql date functions on it, use the FROM_UNIXTIME() function. If you want to store dates in mysql timestamp fields, use in a select statement a) UNIX_TIMESTAMP() or b) DATE_FORMAT() to a) convert to unix timestamp and process with PHP or b) format date for output. http://dev.mysql.com/doc/mysql/en/date-and-time-types.html http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html kgt bruce wrote: or.. better yet. if i do a php - time(), i get a unix_timestamp var. how do you guys store this in mysql. you can't simply do an insert into a mysql/timestamp var. so how do you convert it? also, once you have the mysql tbl, how do you go from the mysql timestamp var - the php var? thanks bruce -Original Message- From: bruce [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 12:38 PM To: 'John Nichel'; php-general@lists.php.net Subject: RE: [PHP] mysql/php date functions.. so you play with the time/date vars on the php side, and then simply store them in the mysql tbl as a int(10)... or do you actually store the vars in the mysql timestamp... and then use the mysql date/time functions... ie. how would you do the following... get a date (date1) get a date (date2) store the date1/time in mysql add the date1 + date2 and store the result in mysql read the result from mysql, with the result being in the year/month/date format -- or, would you just get the unix_timestamp representation of the dates, and store the 10 int formats in the mysql tbl. you could then extract/select the date information from the tbls, and do all the date calculations in php... the downside to this is that you'd have to convert all the date information from mysql to a human readable format... thoughts/comments/etc... -bruce -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 11:48 AM To: php-general@lists.php.net Subject: Re: [PHP] mysql/php date functions.. bruce wrote: john... that appears to be it!! although i would have assumes it would have done a most significant bit fill with 0's... so my question also comes down to .. do i use the php date functions for date/time manipulation.. or do i use the mysql functions any thoughts/suggestions... -bruce Personal preference I guess. Me, I use UNIX timestamps. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User redirection, passing HTTP AUTH credentials
Dan Trainor wrote: Hello once more, all - I was wondering if it's at all possible to redirect a user to a remote site, while passing HTTP AUTH credentials somehow. I've been tinkering around with making a secure login gateway, and the first server that they log in to would negotiate the login sequence, but the system would have to preserve HTTP USER and HTTP PASSWD to be passed to the remote site, as to be backwards compatible with existing HTTP AUTH-based systems. I'd rather not use http://user:[EMAIL PROTECTED], however. There's got to be a different way. I understand that the user's browser is the actual element in which the username and password are stored for HTTP auth. Is there a way to inject or update this information without any interaction from the visitor him/herself? Thanks again! -dant A few weeks ago, I was asked the same question, due to new M$ security feature: http://support.microsoft.com/kb/834489 The authenticated site is third party and cannot change their login process or type, so that's why HTTP authentication cannot be turned into something else. The idea is that someone can make user:[EMAIL PROTECTED] look like this: [EMAIL PROTECTED] which would make poor unsuspecting people think they were going to microsoft.com. The real problem is described here: http://www.microsoft.com/technet/security/bulletin/MS04-004.mspx and http://support.microsoft.com/?id=833786 If you hover your mouse over the link before this security update was applied, you should only see www.microsoft.com, not the entire link url because of the %01 character. So, obviously, the whole thing has to be disabled! Okay, so then I looked into an AJAX-type thing, wondering if the browser would cache authentication if I passed it in a Javascript call. I gave it a shot, but kept getting script syntax errors. Apparently the same security update that disabled authentication in the url disabled it in the XMLHTTP open method: http://www.codingforums.com/archive/index.php/t-45348.html The workarounds MS described in 834489 (two of which are tell them to enter the user name and password and don't do it at all. shoot me.) are all MS specific, and it'd be nice to find a method that would work on all (most) browsers. This is where I ended my research, but hopefully it will keep some other poor soul from having to wade through the MS knowledge base battling vague references to vulnerabilites and security holes. Good luck, and please let me know what your solution is. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Automatically generated emails
LOL. They could have opened up their browser window and performed the following: http://www.google.com/search?hl=enq=php+send+email+after+form+submitbtnG=Google+Search But I think they were trying to suggest that you 1. do the same, or 2. ask a more specific question. kgt Ravi Gogna wrote: Nice to know that newbies are well looked after on these lists. If you didn't wanna help, you could have not clicked reply Jay Blanchard wrote: [snip] Yes. [/snip] Watch out, this'll start a flood of why can't you be nice? e-mail John, any relatives still in LA? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to suppress HTTP headers?
Or use sockets... http://us3.php.net/manual/en/function.fsockopen.php Just don't send any HTTP headers. kgt [EMAIL PROTECTED] wrote: BTW: I made a mistake last time. Apparently with CLI there are headers. You can use php -q to suppress headers when using PHP via CLI. Odd. Not sure I had to do that when I wrote a few CLI scripts before. Oh well, something to play with another day (don't have time to check it right now). So another thing I may be wrong on.. but a thought.. If you use the header() command, does it prevent the web server from generating it's own headers? That is, if you send out htmlbodySomething/body/html does the web server automatically generate the headers but if you use header() it uses what PHP generates rather than it's own? If so.. can you just do: header(); With nothing in it to suppress headers? Or can you do something like: header(xmlstuff/xml); ? Just thinking out loud since nobody else has responded yet :) -TG = = = Original message = = = I knew my description was a bit mangled; I was trying to keep it short. Sorry. Take two: A remote server is sending event records to my server using HTTP POST requests to http://my.server.com/storeit.php, let's say. The remote server expects acknowledgement by way of a response to its request. My script (storeit.php) must respond like it would any other page request over HTTP; it simply uses echo/print to produce a response. This would work fine EXCEPT that the remote server is *badly* written. Its flaw? The HTTP headers included in my response trip it up. For some reason, it expects just the *contents* of the response, without headers. Here's a mock up of the current situation: ---Received from remote server HTTP/1.0 storeit.php POST Content-Type: text/xml Content-Length: 35 Host: 11.11.11.11 DATA KEYvalue/KEY /DATA --- Reply sent to remote server HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 34 Host: 22.22.22.22 ACK ERROR0/ERROR /ACK What the reply needs to look like is: --- Reply sent to remote server ACK ERROR0/ERROR /ACK No headers. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 16, 2005 11:00 AM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP] How to suppress HTTP headers? So their page POSTs to a PHP page that you've created? I'm not seeing where headers come into play there, they're on output, not input. Maybe I just stayed up too late last night, but I'm having trouble wrapping my brain around the problem. One thing I did notice was you mentioned switches for CGI vs CLI SAPI. I expect that there wouldn't be a switch for CLI because no headers are needed when using PHP command line, therefore nothing to turn off. Again, maybe I'm misunderstanding the situation but thought I'd throw that thought in the ring. Maybe you can describe the interaction between the system you can't control and your PHP scripts better. Walk us through it step by step. -TG = = = Original message = = = I am coding a PHP page to deal with a badly implemented automated status update script on a remote server (that I do not control) which fails if my response to it's POST request has HTTP headers. Go figure. So the question is How do I NOT send HTTP headers in my response? or How can my script suppress headers completely? Whatever the solution, it should affect only this page/script. In chapter 43, the PHP Manual states: Though the CGI SAPI provides a way to suppress HTTP headers, there's no equivalent switch to enable them in the CLI SAPI. How would one suppress HTTP headers, as noted above, in the CGI SAPI for a particular page on my site? Somebody, please help. --TC. ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Everything works...Unless they hit the back button...
Jack Jackson wrote: Kristen G. Thorson wrote: You said If the user makes changes, those changes get error checked but do not become part of the sql query. Where in your code is it failing to become part of the query? Put a check at each level and see where *exactly* it fails to get deep enough to become one with the query. Also, I'm confused. I asked if the query was what you're expecting, and you answered yes, which implies the data becomes part of the query. Thanks for this; yes I was confused before and thank you for the clarification. Now I am confused by how to check the logic: I echo out the sql as it is built, and if I'm going forward in the questionnaire it shows clearly but $qidlist_sql=DELETE FROM teresa WHERE q_id IN ( . (implode(,,$qidlist)) . );; echo br /br /; echo br /\$ cqidlist_sql: . $qidlist_sql . br /; $q_a_sql=INSERT INTO teresa (u_id, q_id, a_id ) VALUES . (implode(,,$qanda)) . ;; mysql_query($qidlist_sql); echo br /br /; echo br /\$ q_a_sql: . $q_a_sql . br /; if($q_a_result = mysql_query($q_a_sql)) { unset($_SESSION['required_fields']); $cat = $_POST['cat']+1; include_once(QUESTIONS . 'q.inc'); } shows NOTHING if I hit the BACK button. I'm still not seeing where the logic error is which makes it so that when I hit the BACK button it loses the plot. Sorry for my misunderstanding JJ Keep going backwards. It looks like maybe you've got an IF statement that you're not getting past. Find where that is, and why it's evaluating to false. If it's outputting *nothing*, then you're not evening reaching those echo statements. Make a note after every IF statement, something like echo Inside if( this == that ); So you know which blocks of code are being processed. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is gethostbyaddr() slow?
kalinga wrote: On 8/4/05, Kristen G. Thorson [EMAIL PROTECTED] wrote: kalinga wrote: if you are quering a external host, the bad network conditions may cause delay in results. if your server is connected to a heavily loaded hub/ cheap switch, or the target hosts DNS servers are poorly configured/ slow in responce it adds further delay to your result. try dig/ nslookup on your server for the target hostname/address, you may experience the same delay as with the php function. Thanks for the reply. The problem I had - and that I was trying to briefly describe - is not quite explained by slow DNS lookup, at least not so far. I have one script, run on the same machine: takes less than 1 second on CLI: # php gethostbyname.php Content-type: text/html X-Powered-By: PHP/4.3.2 gethostbyname(www.imakenews.com) took 0.0010 s and resolved to 208.254.39.65br gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 63.87.252.162br gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to 216.239.113.159br gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 63.87.252.162br Running CLI again, host names are apparently cached, because then they all return in .0005 seconds. takes 20 seconds under Apache 2.0.46: gethostbyname(www.imakenews.com) took 5.0071 s and resolved to 208.254.39.65 gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 63.87.252.162 gethostbyname(itpapers.zdnet.com) took 5.0097 s and resolved to 216.239.113.159 gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 63.87.252.162 This will happen consistently, with less than 1/100 s variation in time for each lookup. Any DNS lookup tools are perfectly fast when run from the command line. Also, other machines in the same subnet, using the same DNS servers, using 99% same apache config files (I diff'ed 'em) run just as fast under same apache/php version as they do command line. It's hard to imagine what external DNS problem could exist that would affect only one of our servers, and on that one, only apache/php and nothing command line. Something else is going on, but my initial tries of downgrading/upgrading both php and apache haven't made a different yet. Perhaps you have another suggestion? could you please mention the environment, i mean, the os, and the versions of php? is it binary install or a compile? All binaries - RH-packaged rpms. Working version (takes 1 second for each gethostbyname() call under CLI and under apache): # rpm -qa | grep php php-odbc-4.3.2-23.ent php-imap-4.3.2-23.ent php-pgsql-4.3.2-23.ent php-4.3.2-23.ent php-ldap-4.3.2-23.ent php-mysql-4.3.2-23.ent # rpm -qa | grep httpd httpd-2.0.46-46.ent redhat-config-httpd-1.1.0-4.30.2 httpd-devel-2.0.46-46.ent # uname -r -o -i -s Linux 2.4.21-4.ELsmp i386 GNU/Linux Not working (takes 5 seconds for each gethostbyname() call under apache, but 1 second under CLI): # rpm -qa | grep php php-imap-4.3.2-23.ent php-4.3.2-23.ent php-odbc-4.3.2-23.ent php-mysql-4.3.2-23.ent php-ldap-4.3.2-23.ent php-pgsql-4.3.2-23.ent # rpm -qa | grep httpd httpd-2.0.46-46.ent redhat-config-httpd-1.1.0-4.30.2 httpd-devel-2.0.46-46.ent # uname -r -o -i -s Linux 2.4.21-4.ELsmp i386 GNU/Linux The function returns correctly, but it takes about 5 seconds every time. After I run the script the first time on the not working machine, it looks like the names are cached for the CLI, as they tend to take only .0005 seconds to resolve. Thanks for the help. kgt
Re: [PHP] Is gethostbyaddr() slow?
I can say from personal experience that gethostbyaddr() and gethostbyname() can seem almost randomly slow, depending on machine, OS, software, who knows. I'm not smart enough to figure out the reason why it can vary so much on machines with nearly the same configuration, but I can tell you that it works perfectly fast most of the time. Then there's that other 5% where something makes it slow as molasses. I have two machines that are so similar it's not funny, but gethostbyname() takes 1/10 s on one, and 5 s on the other. I have yet to figure out what's the difference between them that causing this. kgt Dotan Cohen wrote: Hi all, I just discovered the gethostbyaddr() function. By reading the user contributed notes, I get the impression that either this function may cause performance problems, or a user-contributed function based upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous? Thanks! Dotan Cohen http://lyricslist.com/lyrics/artist_albums/56/bangles.php The Bangles Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Is gethostbyaddr() slow?
kalinga wrote: if you are quering a external host, the bad network conditions may cause delay in results. if your server is connected to a heavily loaded hub/ cheap switch, or the target hosts DNS servers are poorly configured/ slow in responce it adds further delay to your result. try dig/ nslookup on your server for the target hostname/address, you may experience the same delay as with the php function. Thanks for the reply. The problem I had - and that I was trying to briefly describe - is not quite explained by slow DNS lookup, at least not so far. I have one script, run on the same machine: takes less than 1 second on CLI: # php gethostbyname.php Content-type: text/html X-Powered-By: PHP/4.3.2 gethostbyname(www.imakenews.com) took 0.0010 s and resolved to 208.254.39.65br gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 63.87.252.162br gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to 216.239.113.159br gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 63.87.252.162br Running CLI again, host names are apparently cached, because then they all return in .0005 seconds. takes 20 seconds under Apache 2.0.46: gethostbyname(www.imakenews.com) took 5.0071 s and resolved to 208.254.39.65 gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 63.87.252.162 gethostbyname(itpapers.zdnet.com) took 5.0097 s and resolved to 216.239.113.159 gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 63.87.252.162 This will happen consistently, with less than 1/100 s variation in time for each lookup. Any DNS lookup tools are perfectly fast when run from the command line. Also, other machines in the same subnet, using the same DNS servers, using 99% same apache config files (I diff'ed 'em) run just as fast under same apache/php version as they do command line. It's hard to imagine what external DNS problem could exist that would affect only one of our servers, and on that one, only apache/php and nothing command line. Something else is going on, but my initial tries of downgrading/upgrading both php and apache haven't made a different yet. Perhaps you have another suggestion? Thanks, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Everything works...Unless they hit the back button...
The code below isn't much help to debug. Do some checking to figure out how far into your IF statement you're getting. Is the query running? Is it the query you expect? (Step #1 when inserting or creating dynamic queries that aren't working: print them out to make sure they are what you think they are.) Is the category being incremented? You say you can go back, but you can't go forward. Look at the page source, is the form action what it should be? Look at the form hidden variables (if any) are they what you expect? kgt Jack Jackson wrote: Hi, mark, snip Mark Rees wrote: Do you want to allow people to go back and change things ? If so, write a suitable UPDATE statement /snip Thanks, but I think the update function should be built in -- the sql checks whether the userAnswer table contains the q_id the user has just entered; if so, it deletes the row containing it and then the second query inserts the new values. $qidlist_sql=DELETE FROM teresa WHERE q_id IN ( . (implode(,,$qidlist)) . ); $q_a_sql=INSERT INTO teresa (u_id, q_id, a_id ) VALUES . (implode(,,$qanda)) . ;; I think there's something wrong with the logic of how I'm handling $_POST info and passing it back and forth: here's why: if I close the browser and reopen it and refill the same questions, the answer table shows the updated answers. there's something in the logic I am using about how I am advancing the $cat and managing the $_POST information. I think . But I cannot find it. Anyone? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calculation error - PHP not following math hierarchi ???
See http://us3.php.net/manual/en/language.operators.php http://us3.php.net/manual/en/language.operators.bitwise.php You want this: function calc_distance($curX,$curY,$newX,$newY) { // calculate distance to new location $distX = abs($curX - $newX); $distY = abs($curY - $newY); if ($distX = 150 $distY = 150) { $dist = sqrt(pow( $distX,2) + pow($distY,2)); } elseif ($distX 150 $distY = 150) { $dist = sqrt(pow((abs(300 - $newX)),2) + pow($distY,2)); } elseif ($distX = 150 $distY 150) { $dist = sqrt(pow($distX,2) + pow((abs(300 - $newY)),2)); } else { $dist = sqrt(pow((abs(300 - $newX)),2) + pow((abs(300 - $newY)),2)); } return $dist; } echo calc_distance( 150, 150, 300, 300 ); //echoes 212.13203435596 echo br150^2=.(150^2). and pow(150,2)=.(pow(150,2)); //echoes 150^2=148 and pow(150,2)=22500 kgt Rene Brehmer wrote: I've run into a situation where PHP is way off when doing a relatively simple calculation of distance between two points in 2-dimensional space, where coordinates go from 1 to 300 in both X and Y directions. When passing 300, it goes back to 1, and vise-versa (it's for a game and is supposed to approximate the movement over a sphere). Using this function: function calc_distance($curX,$curY,$newX,$newY) { // calculate distance to new location $distX = abs($curX - $newX); $distY = abs($curY - $newY); if ($distX = 150 $distY = 150) { $dist = sqrt($distX^2 + $distY^2); } elseif ($distX 150 $distY = 150) { $dist = sqrt((abs(300 - $newX))^2 + $distY^2); } elseif ($distX = 150 $distY 150) { $dist = sqrt($distX^2 + (abs(300 - $newY))^2); } else { $dist = sqrt((abs(300 - $newX))^2 + (abs(300 - $newY))^2); } return $dist; } And using 150,150 as $curX,$curY and 300,300 as $newX,$newY ... PHP calculates $dist as 3.46410161514 which obviously is far off target ...referring to my calcultor, the correct result for the same code is supposed to be 212.1320 What happens here ? And how the heck do I get to calculate right ? Float errors usually isn't this severe, so I'm assuming it's a problem with properly acknowledging the hierarchi of the mathematical operators ... It's PHP ver. 4.3.0, on Apache/2.0.53 (Win32), on WinXP SP1 I've been trying to manually calculate the formula out of order to figure out how the strange result comes about, but haven't had any success yet ... Any suggestions ? Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Job for SQL or PHP?
Try INSERT INTO Orders (SELECT '678',Cust_ID,Item_No,No_ordered FROM Last_Order WHERE Cust_ID = '678') kgt -k. wrote: Just for the sake of example let's say i keep track of all of a customers previous orders in a table like this: Last_Order -- Cust_ID Item_No No_ordered When a customer places an order i put the order details in an a table like this: Orders --- Order_ID Cust_ID Item_No No_ordered Let's say when my customer returns he decides he wants everything he ordered previously plus some other stuff. Assuming this customer has unique customer ID of 345 and his current new order id is 678. Can i copy his last order into the orders table with just a SQL statement like: INSERT INTO Orders VALUES ('678',(SELECT * FROM Last_Order WHERE Cust_ID = '678')) What i want to do is grab all the data from Last_Order associated with cust_id 345 (or whatever) and insert it into the Orders table with a Order_ID in this case 678. Let me know if this isn’t clear. This SQL obviously doesn't work, however, my question is there a way to do this with SQL alone? Or do i need to grab all the records from the Last_Order table loop through the record set and insert each new row into Orders individually? -k. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Everything works...Unless they hit the back button...
You said If the user makes changes, those changes get error checked but do not become part of the sql query. Where in your code is it failing to become part of the query? Put a check at each level and see where *exactly* it fails to get deep enough to become one with the query. Also, I'm confused. I asked if the query was what you're expecting, and you answered yes, which implies the data becomes part of the query. kgt Jack Jackson wrote: I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no good because it's all coming from the same page - index.php!! What am I missing. . . ? Jack Jackson wrote: Hi Kristen, there's a misunderstanding: Kristen G. Thorson wrote: The code below isn't much help to debug. Do some checking to figure out how far into your IF statement you're getting. Is the query running? Yes it runs successfully Is it the query you expect? Yes it is perfect, and provided this is a new session and we're going forward page by page, it properly deletes from and inserts to the db as expected (Step #1 when inserting or creating dynamic queries that aren't working: print them out to make sure they are what you think they are.) Is the category being incremented? Yes, absolutely You say you can go back, but you can't go forward. Actually no. In a new session, I can start and go forward page by page to the end of the questionnaire, advancing each stage perfectly, storing all values exactly as I'd expect. The trouble starts if, during the process, the user hits the BACK button. At that point, user can reload the last page of questions, displaying the answers they gave. If the user makes changes, those changes get error checked but do not become part of the sql query. Also, user can not move forwards any more. So it's as the subject says - everything works...until they hit the back button, from which point the whole thing goes gablooey. Look at the page source, is the form action what it should be? Yes Look at the form hidden variables (if any) are they what you expect? No. $cat remains what it was BEFORE the user hit the BACK button. However the questions dispayed are from the $cat which is in fact $cat-1 ??!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Suppression with '@'
Example: I was working on a HORRIBLE piece of code for a cart app. The original programmer had a line like this: $result = mysql_query( SELECT * FROM user_logins WHERE cookie='.$cookie.' ); Where $cookie is a session id stored in a cookie (what else? ;). The problem was, he had some faulty code that was not always properly setting the cookie. So then he went and did the following: $customer_id=mysql_result($result,0,id); Problem is, $cookie='' but there are no entries in the user_logins table where cookie=''. So, the query is empty and trying to pull the customer ID gave the nice little warning because E_ALL was on: *Warning*: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in *cart.php* on line *26* So customers get confused because of the warning and on top of that they have no items in their cart because customer_id is used to look up temp carts (and it wasn't set). He couldn't figure out why it was happening and he didn't have logging turned on, so all he had was Billy Bob saying My cart is gone. There was an error. I don't know what it was. I didn't write it down. So then he decided to put an @ in front of the offending lines. Customers no longer get an error. Excellent. But wait! Three months down the road, we have the problem of the vanishing carts. So third-party programmer comes in, turns on logging so I can see the stupid errors and figure out what's going on, but errors have been repressed! This is not helpful to anyone, I then have to go through and figure out whether it will break something by removing those stupid @'s (there were a LOT of them). The problem wasn't that he was using @, but that he was not properly checking for errors, and used @ to suppress bugs he couldn't duplicate or couldn't figure out how to fix. In short, if you don't want the customer to see the error, turn of reporting and turn on logging. Anyone trying to debug your code three years later will thank you. my 2c. kgt Justin Burger wrote: Good Morning, I was having a discussion with a fellow PHP Developer this morning and he mentioned that he put's an '@' sign in front of all function calls, and every time he accesses an array; I know that this is sloppy, and dangerous, but I don't know exactly what this exposes him to, can any one give me any real world examples of why this is bad, so I can relate it to his code? php.net does not have much information about this. It seems like suppressing errors, rather then catching them is problematic. Thanks Again. Justin.
Re: [PHP] error checking woes
Jack, Read below: Jack Jackson wrote: Hi, Now that the drop down is working properly (thanks!!), I am trying to validate, and having LOTS of trouble. After being ceaselessly derided last night on an irc channel for my dimwitedness, I am still not any closer. The code which works is this: function GetQuestionsDropdown($cat){ //first get all the questions $sql = SELECT * FROM questions WHERE questions.q_cat=$cat AND questions.q_style=1; $result = mysql_query($sql); //now one-by-one go through the questions while($row = mysql_fetch_assoc($result)) { //if the form has been submitted, and the question unanswered //highlight this whole question and answer block in red. if ($message[$row['q_name']] == 1){ How does this funtion have access to $message? You need to a) make it global or b) pass it in. echo div class='error'; } //Make a question set div wrapper echo div class='q_set'\n; //State the question echo div class='question'; echo $row['q_text'] . /div; echo \n\n; echo div class='answer'; echo \n; //Create the dropdown for the answers echo ' select name=' . $row['q_name'] . ''; echo \n; //get all of the answers for THIS question $ans_sql = select * from answers where answers.q_id= . $row['q_id']; $ans_result = mysql_query($ans_sql); echo option value=\\Select from this list/option\n; while($ans_row = mysql_fetch_assoc($ans_result)) { //list the answers for THIS question echo option ; echo value=\ . $ans_row['a_id'] . \; if ($row['q_name'] == $ans_row['a_id']) { echo selected; } echo . $ans_row['a_answer'] . /option; echo \n; } echo ' /select' . \n . ' /div' . \n; echo /div!--q_set--\n\n; //If there *was* an error div, close it if (sizeof($message[$row['q_name']])){ echo /div!--/error--; } } }//function GetQuestionsDropdown NOW I have to validate after it's submitted. I am trying to look and see, if $_POST[$row['q_name']] is empty then make message of the same name = 1, so if if(empty($_POST['partners'])) { $message['partners'] = '1' } Then when I restate the dropdown function, and it shows the questions again, those error checking things I built in will a) show a div class=error around questions with a message b) pre-select the previously selected answers (because I have put in the thing in the dropdown which says if ($row['q_name'] == $ans_row['a_id']) { echo selected;} The validate code I was trying, the subject of such howling on IRC (and I know it doesn't work, but not why) was: function ValidatePost($cat){ //first get the q_names $sql = SELECT * FROM questions WHERE q_cat=$cat; $result = mysql_query($sql); //go through the question set while($row = mysql_fetch_assoc($result)) { if(empty($_POST[$row['q_name']])){ $message[$row['q_name']] == 1; You want $message = 1 here. = = is for comparison. You're setting $message inside a function. This means it doesn't exist outside this scope! } } }//function ValidatePost Can anyone tell me what I am doing wrong? Thanks! JJ Hope this helps you get somewhere, kgt
Re: [PHP] PHP code in a MySQL record
Is there a particular reason you need *PHP* in the database? If not, then use a placeholder system of some sort ( like #var# ) and str_replace(): while( $row=mysql_fetch_row($result) ) { echo str_replace( '#var#', $that_var, $row['entry'] ); } kgt Nathaniel Hall wrote: I am working on a project that uses an index.php page. Depending on the variable in the URL, a different php page is included. I have a config.php that contains variables that are accessible from any page. That is the easy part. I have some pages pulling HTML out of a database. I would like to be able to reference some of the variables in the config.php in the database blob field. Here is an example: [EMAIL PROTECTED] -- htmlhead...etc ?php include 'config.php'; if (blabla) { include thispage.php; } else { include thatpage.php; } ? config.php -- ?php $this_var=1; $that_var=Nothing; ? test.php -- ?php $query=SELECT * from table; $result=mysql_query($query) or die (Cannot process query); $row=mysql_fetch_row($result); echo $row[1]; ? MySQL record: -- id,year,month,day,entry 1,2005,01,01,This is a testbr? echo $that_var; ? _ I have tried using brgt;? echo $that_var; ?lt; and I have tried escaping everything, but that still didn't work. Any ideas? Nathaniel Hall [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dropdown Building Function
I'm not 100% sure where you're saying you're stuck, but I think you're trying to do with one query what you will probably find is best to do with several. Hopefully the following will help some: //first get all the questions $sql = select * from questions; $result = mysql_query( $sql ); //now one-by-one go through the questions while( $row = mysql_fetch_row( $result ) { //create the drop down box for THIS question echo 'select name='.$row['question_text'].''; //get all of the answers for THIS question $ans_sql = select * from answers where question_id=.$row['question_id']; $ans_result = mysql_query( $ans_sql ); while( $ans_row = mysql_fetch_row( $ans_result ) ) { //list the answers for THIS question echo 'option value='.$ans_row['answer_id'].''.$ans_row['answer_text'].'/option'; } echo '/select'; } outputs: select name=question1 option value=1answer 1/option option value=2answer 2/option option value=3answer 3/option select name=question2 option value=1answer 1/option option value=2answer 2/option option value=3answer 3/option option value=4answer 4/option option value=5answer 5/option It requires numerous DB calls, but I believe in most cases, it's still better than what you'd have to do otherwise (create some arrays and do some sorting, etc.). That is, if I've understood what you need ;) kgt Jack Jackson wrote: Hi, can anyone even point me in a *direction*? I suppose this is the most complex thing I've ever tried to do and I have been at it for tens of hours and am still completely baffled. Jack Jackson wrote: Hi, because that last topic on multipage forms was so exciting, I decided to database the questions as well. I wonder if anyone can help me with a function to pull rows into dropdown boxes. It's a 1:n relationship between questions and answers, and I have a table of questions q_id q_name q_text q_style //dropdown, radio, checkboxes q_cat //question category and a table full of answers a_id q_id a_answer When I do $fields = 'SELECT *'; $from = 'FROM questions,answers'; $sort = ORDER BY questions.q_cat; $where = WHERE answers.q_id=questions.q_id; // construct the sql query: $sql = $fields $from $where $sort; // Run SQL query 1 if (!($result = mysql_query($sql))) { echo Could not connect to the database ($sql) . mysql_error(); } while ($row = mysql_fetch_assoc($result)) { I need to loop through the results and make a dropdown list from them, taking the question name as the select name, and then making each answer id and answer text the makings of an option ros. Based on a problem a while ago which was similar but different, someone here actually made me a function *similar* to what I need to do now, This one acts different and I just cannot adapt the old one, because I still get confused at this level. I think it wants to be something like (and note that part of the return is the code to react to error checking results): $dropdown[] = 'option ?php if (' . $q_name . ' == ' . $a_id . ') echo selected ; ? value=\'' . $a_id . '\'' . $a_answer . '/option'; etc for all $a_answer(s)... and then return '?php if (sizeof($message[\'' . $q_name . '\'])){ echo div class='error'; } ? div class=\'row\' select class=\'answer\' name=\'' . $q_name . '\' option value=\'\'Select from this list/option' join('',$dropdown) . '/select/div' . '?php if (sizeof($message[\''. $q_name '\'])){ echo /div!--/error--; } ?'; Can anyone point me at the right direction? Thanks!! JJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gethostbyname() time issues
The following script: ?php $url_array = array( 'http://www.imakenews.com/progresspsdn/e_rss.aspx', 'http://rssnewsapps.ziffdavis.com/eweekdeveloper.xml', 'http://itpapers.zdnet.com/xml/RSS-239.xml', 'http://rssnewsapps.ziffdavis.com/eweeklinux.xml' ); foreach( $url_array as $url ) { $rdf = parse_url($url); $timestart = microtime(); $h = gethostbyname($rdf['host']); $timeend = microtime(); $diff = number_format(((substr($timeend,0,9)) + (substr($timeend,-10)) - (substr($timestart,0,9)) - (substr($timestart,-10))),4); echo gethostbyname(.$rdf['host'].) took $diff s and resolved to $hbr\n; } ? takes less than 1 second on CLI: # php gethostbyname.php Content-type: text/html X-Powered-By: PHP/4.3.2 gethostbyname(www.imakenews.com) took 0.0010 s and resolved to 208.254.39.65br gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 63.87.252.162br gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to 216.239.113.159br gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 63.87.252.162br but takes 20 seconds under Apache 2.0.46: gethostbyname(www.imakenews.com) took 5.0071 s and resolved to 208.254.39.65 gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 63.87.252.162 gethostbyname(itpapers.zdnet.com) took 5.0097 s and resolved to 216.239.113.159 gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 63.87.252.162 The DNS server timeout was set to 5 seconds, but we changed it to 10, and it had no effect on either. My efforts to Google this has not lead me in very helpful directions thus far, since gethostbyname() is not actually failing - it just takes 5 seconds to return. Even just a hint of where I might start looking will be much appreciated. Thanks, kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gethostbyname() time issues
Philip Hallstrom wrote: $diff = number_format(((substr($timeend,0,9)) + (substr($timeend,-10)) - (substr($timestart,0,9)) - (substr($timestart,-10))),4); This just looks wrong to me... at the very least shouldn't it be: (x + x) - (x + x) (x + y) - (w + z) = (x + y) + (-w - z) = x + y - w - z Which is what I have. If you look closely, I don't have (x + x) - (x - x), which yes, would be wrong. You've currently got the last + as a -. Also, why not split the result of microtime on a space in case $usec is more than 9 digits? $usec is microseconds. I'm not really concerned about more than ten-thousandths of a second, so I don't even really need 9 digits. Conversly, I only need the seconds digits that are changing, and I can guarantee (hopefully) that my script is not taking so long that I need more than 10 digits to calculate the difference in seconds. It may be ridiculously convoluted code, I'll grant you that ;) - I took it from old script somewhere and didn't think of the looking in the manual for the much simpler example - but I'm pretty sure the math is fine. Anyways, I can assure you that it is too fast for me to count 1, 2, 3 CLI, but I get up to 20-something waiting for it to run under apache. Any ideas? kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 404 error - DLL files needed ??
In the extension manager for the site/directory where this is not working, make sure the check box Verify file exists is not checked. I think I ran into a similar problem with a different extension and had the same issue. kgt Grosz, Steve (IPG IT) wrote: Tjoekbezoer, I can tell you that it is there, because I manually added it, and it is set to 'allowed'. Steve -Original Message- From: Tjoekbezoer van Damme [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 13, 2005 3:52 PM To: php-general@lists.php.net Subject: Re: [PHP] 404 error - DLL files needed ?? On 7/13/05, Grosz, Steve (IPG IT) [EMAIL PROTECTED] wrote: I tried that, renamed a txt file to .php, but when I try to get the .php file, I just get a 404 error. Grosz, this might very well be your webserver invoking. By default, IIS 6.0 all webserver extensions (like PHP). To check if your server still does, open up your IIS manager (Start-Run-'c:\windows\system32\inetsrv\iis.msc') Then browse to Web Service Extensions on the left. If you did install PHP correctly you should see PHP appearing in the list on the right. Set it to 'Allowed'. Now try requesting the page via your browser again. Good luck! Tjoekbezoer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot connect to MySQL server and not sure why
MySQL authentication is user+host+password. Make sure user brucer_webmaster has host 69.90.88.155. kgt Bruce Gilbert wrote: I am having trouble connecting to MySQL server through a PHP script and I am not sure why. the error I receive is: Warning: mysql_pconnect(): Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /hsphere/local/home/bruceg/inspired-evolution.com/search/include/connect.php on line 6 Cannot connect to database, check if username, password and host are correct. trying to connect with the following script: ?php $database=bruceg_search; $mysql_user = bruceg_webmaster; $mysql_password = password; $mysql_host = server-10.existhost.com; mysql_pconnect ($mysql_host, $mysql_user, $mysql_password); if (!$success) die (bCannot connect to database, check if username, password and host are correct./b); $success = mysql_select_db ($database); if (!$success) { print bCannot choose database, check if database name is correct.; die(); } ? I double checked the database and I have created a database called bruceg_search and added a user called bruceg_webmaster with all of the editing privileges. Of course 'password' is changes with the password used to connect in the actual script. and I double checked that to be correct as well. Any suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() problem
Philip Hallstrom wrote: of leap years between the two dates. Leap years occur every 4 years, and 17 / 4 = 4.25, so there were 4 leap years between 7/6/88 and 7/6/05 and Just to nitpick... :-) http://en.wikipedia.org/wiki/Leap_year The Gregorian calendar adds an extra day to February, making it 29 days long, in years where the quotient has no remainder when divided by 4, excluding years where the quotient has no remainder when divided by 100, but including years where the quotient has no remainder when divided by 400. So 1996, 2000, and 2400 are leap years but 1800, 1899, 1900 and 2100 are not. Touche! One more reason not to use the OP's method but rather the one posted by Richard Lynch. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() problem
Ryan A wrote: Hi, I'm confused, this should give me the age as 17 instead of 16...but it does not...any ideas why? ?php print date(Y:m:d); $age=1988-07-06; $day1=strtotime($age); $day2 = strtotime(date(Y-m-d)); $dif_s = ($day2-$day1); $dif_d = ($dif_s/60/60/24); $age = floor(($dif_d/365.24)); echo $age; ? Thanks, Ryan Subtracting the timestamps gives you 536457600 seconds, which is correct, but ( $dif_s / 60 / 60 / 24 ) gives you the actual number of days between these two dates. We say on *average* there are 365.25 days in a year, so 17 years (the correct age in years between these two dates) has about 17 * 365.25 = 6209.25 days. In actuality, there are 6209 days between these two dates. This seems close, but note that 6209.25 / 365.25 = 17 but 6209 / 365.25 = 16.9993155 And of course floor on 16.9993155 is still just 16. I don't think you can accurately calculate dates in this way without calculating the actual number of leap years between the two dates. Leap years occur every 4 years, and 17 / 4 = 4.25, so there were 4 leap years between 7/6/88 and 7/6/05 and therefore 365 * 17 + 4 = 6209 days, the actual number of days between these two dates. But note that ( 6209 - 4 ) / 365 = 17, which is correct. If you subtract the number of extra days due to leap years, then there are precisely 365 days in each year. It boils down to the fact that though there are on *average* 365.25 days in a calendar year, there are never *actually* 365.25 days in a calendar year. There are only either 365 or 366. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird Image Problem
Richard Lynch wrote: On Wed, June 29, 2005 3:30 pm, Shane Little said: I'm bin2hex'ing images from an upload script and inserting into a mysql blob field. The php script that re-packs the hex data back to binary, does the createimagefromstring() and streams the image to the browser is generating a corrupted image... i.e. The image looks fine until part-way down... then... no more image; just a gray background where the rest of the image should be. Seems to happen on image any larger than 30 or so kilobytes. Anybody working the the php image libraries seen this before? Storing images inside MySQL is almost always a Bad Idea in the first place... I'll assume you know that, and have good reason to not use the super-fast, custom-optimized large-data software specifically designed to handle your images. * First, check that MySQL blob fields are not limited to 32K somehow. I suspect that they are. Next, one has to wonder why use bin2hex? Yes, it should generate only 0-9a-f characters, which are all valid for MySQL, but surely that is not the best way to do this... I don't store images in MySQL, so don't KNOW what is the best way, but I'm putting money down right now that bin2hex ain't the best way. * the super-fast, custom-optimized large-data software specifically designed to handle your images is known as... The File System. :-) MySQL blobs are actually limited to 64K. I think a MEDIUMBLOB holds about 16 MB if you're dead-set on storing the image in the database. You might want to check that your max_allowed_packets size is large enough. You can find that by querying SHOW VARIABLES LIKE 'max_allowed_packet'; I just double-checked the manual. It does say that this needs to be set to the largest blob. kgt
Re: [PHP] Removing nonlatin characters
Have you seen: http://us2.php.net/manual/en/function.recode-string.php kgt Dotan Cohen wrote: I thought that this was another old STFA but marc and google are quiet. I as parsing a bunch of submitted works and some of them have non-latin characters. I know that I once saw in the user-submitted notes in the docs a function for replacing them with o,a,i,e,u but I can't find it. I think that it may have been purged. Can anyone help? Dotan http://lyricslist.com/lyrics/artist_albums/109/carlisle_belinda.php Belinda Carlisle Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Showing tables (converting from MySQL to Oracle)
This is really a question for an Oracle list, but I happen to know of the following page which has been helpful to me in the past: https://gdsg.ngdc.noaa.gov/tiki/tiki-index.php?page=SqlNotes kgt Shane Presley wrote: Hello, I've recompiled PHP to use Oracle, and been able to run a quick test script that looks like... ?php if ($c=OCILogon(user, pw, server)) { echo Successfully connected to Oracle.\n; OCILogoff($c); } else { $err = OCIError(); echo Oracle Connect Error . $err[text]; } ? So now I'm going through and converting my MySQL code to Oracle. I've finished the connect functions, but getting hung up on how to do queries. For example the first query wants to SHOW TABLES. Not sure how to do this with Oracle calls? function get_tables($link) { $tableList = array(); $query = SHOW TABLES; $result = perform_query($query, $link); while($row = fetch_array($result)) { array_push($tableList, $row[0]); } return $tableList; } function perform_query($query, $link) { if($link) { $result = mysql_query($query, $link) or die('Query failed: ' . mysql_error()); } else { die('No DB link'); } return $result; } Thanks! Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checkboxes From Intersection Redux
Hopefully I understand your question correctly. You have this SQL: $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; And For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. The problem is, the SQL you have is not returning every media_id (because you're grouping on media_name). I wonder if you truly need to group on media_name. I would assume that media_name is unique in the media table. If it is not, then you need to rethink your table structure. If you group on media_name and there are duplicate media_names, you can have data like this: media_id media_name 4Name1 16 Name1 Grouping by media_name as in your query above will produce a line like: media_idmedia_name 4 Name1 You then output this to check boxes and use those to set the relation to art and media. But what's the difference between media_id 4 and media_id 16? In this case, if the database always returns the group by this way, you would never set the media_id 16. If there is a distinct difference between media_names with different ids, then I think you probably need to make some changes. That being said, if you do not need to group by media_name, then you can simply do something like this: select media.media_id, media.media_name, media_art.art_id, from media left join media_art on media_art.media_id=media.media_id and media_art.art_id=$cartoon['art_id'] Which would return a table like this if $cartoon['art_id']=15: media_idmedia_name art_id 4 Name1 NULL 8 Name2 15 12 Name3 NULL 16 Name4 15 17 Name5 NULL 18 Name6 NULL You could then test the output of art_id: $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' .(rows['art_id']==$cartoon['art_id']? checked:)./{$media_rows['media_name']} ; HTH kgt Jack Jackson wrote: Hi, With your help I got some checkboxes generated the other day for a form. I would like some help getting a similar problem solved. I am now making a form to edit db entries made in the previous form. I have three tables involved: art, media and media_art. I need to show checkboxes for all available media. For the chosen record ($cartoon, which equals an art_id selected by the user) I must also go into the media_art table, and where the selected art ID has a corresponding media_id, display that media_id's media_name as a checked box. TABLE media: media_id media_name 1 ink 2 pencil 3 watercolor 4 gauche 5 watercolor pencil To find out the art_id of the chosen record, the user is selecting from a dropdown box in the form. I'm doing queries like this to make a publisher dropdown in a similar vein: $query = SELECT * FROM art WHERE art.art_id = '$cartoon'; $publisher_query = 'SELECT * FROM publisher'; $result = mysql_query($query); $publisher_result = mysql_query($publisher_query); while ($rows = mysql_fetch_assoc($result)){ $publisher_dropdown = 'select name=publisher_id'; while ($pub = mysql_fetch_assoc($publisher_result)){ $publisher_dropdown .= 'option value=' . $pub['publisher_id']; if ($pub['publisher_id'] == $rows['publisher_id']){ $publisher_dropdown .= ' selected '; } $publisher_dropdown .= '' . htmlentities($pub['publisher_name']); } $publisher_dropdown .= '/select'; } I now need to formulate how to make the checkboxes similarly. The original setup to make the checkboxes was : $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; $media_result = mysql_query($media_query); $checkbox_media = array (); $media_types = array(); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' /{$media_rows['media_name']} ; } Those which were checked were inserted into media_art thusly: media_id art_id 31 41 51 What I want to do is say For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. How can I do this? Thanks very much in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/osx and firebird
Undefined service gds_db/tcp. Sounds to me like it's not finding the port in services. I don't know what default port Firebird is listening on, but you should have an entry like gds_db/tcp 1234/tcp in c:\windows\system32\drivers\etc\services. You'll have to find out exactly which port it's listening on. I think you may need this on both the client and the server. kgt James wrote: I have a windows machine with Firebird and the default database. I've configured another machine with Apache and PHP. I want to write PHP scripts to remotely access the Firebird database. I followed the instructions at: http://us3.php.net/ibase I changed the php.ini to enable the php_interbase.dll and the php_gd2.dll by commenting out the two lines under Windows Extensions I also copied gds32.dll from the php directory to the C:\windows\system32 directory. I restarted Apache. This is in my PHP script: $host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb; $username = SYSDBA; $password = masterkey; $dbh = ibase_pconnect ($host, $username, $password); $stmt = SELECT * FROM EVENTTYP; $sth = ibase_query ($dbh, $stmt); I get the following error: Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to complete network request to host 10.1.4.58. Failed to locate host machine. Undefined service gds_db/tcp. in d:\htdocs\Website\PHP\dtest.php on line 17 Warning: ibase_query() [function.ibase-query]: invalid database handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on line 20 I was able to use isql to remotely connect using the parameters above. What am I not doing on the PHP end to get this to work? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache fails to start (oracle path problem?)
I ran into a similar problem trying to get ODBC working with a Progress database. I managed to solve it by setting the environment variables in the httpd startup script. Not much help, I know, but a suggestion. ;) good luck kgt Shane Presley wrote: Hello, I'm having trouble compiling and running PHP with oracle support. I was able to compile with the appropriate configure script, but only after I set my Oracle environment variables in my shell. That was no problem. The problem is, when Apache goes to load the php module, it fails, because it can't find the oracle library. Interactively I had to do this... export LD_LIBRARY_PATH=$ORACLE_HOME/lib But Apache.. Starting httpd: Syntax error on line 207 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/httpd/modules/libphp4.so into server: libclntsh.so.10.1: cannot open shared object file: No such file or directory [FAILED] Not sure how I could set that for Apache? Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beautiful HTML Invoice - Prints like crap! I need somesuggestions!
Most web browsers I know of don't print anything specified as background by default. I imagine that functionality extends to CSS-defined background colors and images. I doubt there's a way to change that preference other than setting it manually. If changing the print settings on your machine will not work for you, then you may consider PDF, though it certainly comes with it's own hassles. kgt Matt Babineau wrote: Ok all - I've been playing with this print styl sheet thing. I can get the media=print to behave correctly, but I cannot get table background colors set. I want to print the table bg colors and background images. I was hoping this was possible with CSS2. Does anyone have any input on this? I build some diagrams using html and graphics which are on the invoice, and I use bgcolor on my tables to show the separator lines in the line item section with the prices and such. I don't know how to proceed best, or if I am heading down a dead end with this. Anyone have any more input on this? Everything I have read so far has been very helpful and I thank you for that. Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED] -Original Message- From: Marcus Bointon [mailto:[EMAIL PROTECTED] Sent: Thursday, June 09, 2005 5:02 AM To: PHP General Subject: Re: [PHP] Beautiful HTML Invoice - Prints like crap! I need somesuggestions! On 7 Jun 2005, at 23:46, Chris Martin wrote: Is a simple CSS print stylesheet out of the question? If the site is marked up properly, this should be trivial, and would be much easier/more efficient. CSS is definitely the way to go. Here are some good articles: http://www.alistapart.com/articles/printyourway/ http://www.alistapart.com/articles/goingtoprint/ Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Of .txt to .zip
That's much clearer than your original question was. Try www.phpclasses.org Good luck. Denyl Meneses Guillén wrote: I do not want to open a ZIP , I want create a ZIP fron TXT . - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Denyl Meneses Guillén [EMAIL PROTECTED]; php-general@lists.php.net Sent: Wednesday, June 08, 2005 7:11 AM Subject: RE: [PHP] Of .txt to .zip [snip] I want that the file with extension .TXT that this in my server, to keep packed it with extension ZIP. Somebody knows since I can do it. [/snip] http://www.php.net/zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find random records in a subset?
Try using a temporary table. It should be pretty fast. You'd do something like 1. Select from table1 according to search criteria 2. Insert data from #1 into temp_table1 3. Random selection from temp_table1 kgt Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, and then use MySQL's in command to find them. I can't use order by rand() due to its performance hit. But I have to take it one more step: I want to first limit my found set to those matching a different search criteria, and then find 50 of those. Anyone? Can this be done all within MySQL, or is it going to require some humongo PHP arrays? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach ($media as $key = $val) problem
Jack Jackson wrote: Hi, all, This might look like a mysql problem but I assure you it's my botching the PHP which is the problem! I'm building a part of a page with info from three tables: art, media and media_art. Media_art is the intersection table. For every entry in art there can be one or more entries in media. art.art_id 1 has two entries in media_art: Media_id art_id 32 52 I do this SQL, which in phpmyadmin returns the two names of media as expected SELECT media.media_name FROM art, media_art, media WHERE art.art_id = 1 AND art.art_id = media_art.art_id AND media.media_id = media_art.media_id Yet here's where I mess up. To see if I've got them in an array, I do: $media = mysql_fetch_assoc($media_result); while ($media = mysql_fetch_assoc($media_result)) { If this particular example has only two rows to return, then the above two lines look like the culprit. $media = ... is fetching the first row, but you're not doing anything with it, then while( $media = ...) will fetch the second and print it out. Take out the first line above. asort($media); foreach($media as $key = $val) { echo key: $key value: $val br /; } } //end while $media = mysql_fetch_assoc($media_result) and this returns only the name of the HIGHer number of the two (that is, 5). What have I done wrong to echo out each name of the media associated with this record? I'm trying, eventually, to echo it out in the age so that it appears as [art_id 1] comprises Ink, watercolor. Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search problem
Jim Moseby wrote: Hi, I need to build up a search module for a shop. If I make a basic search (product title for example) it is ok. $query = SELECT product_id FROM products WHERE title LIKE '%$title%'; But i need an advance search for more than one field (title, description, price, weight) The problem is that i don't know which field is filled in by the user (title, description, price or weight) I mean, the user can fill in all fields, or only price field, or title and weight etc How can i do the search? Thanks $query = SELECT product_id FROM products WHERE title LIKE '%$title%' and description LIKE '%$description%' and price like '%$price%' and weight like '%weight%'; JM While this query would work, using a fulltext index would give you a much more powerful search. Check to see if your database offers some sort of text indexing (it probably does!) Suppose you have a product title like The Lion, the Witch, and the Wardrobe. If your user did a search on lion witch wardrobe, you'd want my example to show up. Just comparing these fields with a LIKE will not give you my result, unless you explode the search string and create several LIKE statements based the individual terms, but then you have to do three LIKE comparisons, which will probably be slower than a full text index. If you are able to use a full text index, then you can write queries like this: $sql = 'SELECT * FROM products WHERE MATCH ( product_title ) AGAINST ( ' .$_REQUEST['product_title']. ' ) AND MATCH ( product_description ) AGAINST ( ' .$_REQUEST['product_description']. ' )'; which would give you The Lion, the Witch, and the Wardrobe if search terms were lion witch wardrobe. kgt
[PHP] Empty string problem
Following is a snippet of code that I am trying to debug. Most of the time, the variable $sn (set on the last line), correctly contains the variable $this_customer_num. On some occasions, however, it does not contain $this_customer_num. I cannot figure out what may be happening that this value is missing around 1-10% of the time. ?php $memberchecker=mysql_query(SELECT id, password, customer_num FROM logins WHERE email = '$email' ); //email is unique and not null if (!$memberchecker) { //handle error } else { if (mysql_num_rows($memberchecker) = 1) { while ($row = mysql_fetch_array($memberchecker)) { $this_login_password=$row[password]; if ($this_login_password==$password) { //$password is a form variable (yes register_globals is on...*sigh*) $this_customer_num=$row[customer_num]; $companycheck=mysql_query(SELECT priority, cash_price FROM customers WHERE customer_num='$this_customer_num'); //customer_num is primary key, so unique and not null if (!$companycheck) { //handle error } else { if (mysql_num_rows($companycheck) == 1) { while ($cow = mysql_fetch_array($companycheck)) { $id=$row[id]; $priority=$cow[priority]; $cp=$cow[cash_price]; $sn=date(Sz).$this_customer_num.time(); ? Before anyone yells at me, no I did not write this code. I first thought there might be a problem with the array keys not being quoted, but if that were the case, and an empty string were assigned to $this_customer_num, then I should not be able to pass the second query, since there are no empty string customer_num entries (all of them are at least 9 characters in length). I have been unable to reproduce an instance where $sn is missing the $this_customer_num variable, and I'm stuck in a kind of political situation where I can only make recommendations, and not change the code myself. Suggestions on where to start looking? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpMyAdmin authentication error
I haven't used mysqli, so I'm not as familiar with errors related to that library, but you said you downloaded the latest package of MySQL, which is hopefully 4.1.12. This version shouldn't cause this error with mysqli. In my experience, this error has always been a case of PHP compiled against MySQL 3.x libraries, so that the PHP client is using the older authentication protocol of 3.23. See below for more information: http://dev.mysql.com/doc/mysql/en/old-client.html kgt Richard Lynch wrote: On Fri, May 13, 2005 3:56 pm, Sam Smith said: Because the install was from mysql.com I don't want to believe the client is out of date. I also don't know how to install another client. Most likely, it's Apple that's a bit behind the curve... So your phpMyAdmin is probably trying to use the mysqli client, but your MySQL server from Apple can only handle mysql client. See if you can get phpMyAdmin for the version of MySQL you have.
Re: [PHP] Inner Join or 2nd Query...?
I don't understand what you're trying to do. Do you want two separate list boxes, one for product types and one for makers? If so, use two queries. Use the same block of code you have for product types to populate the makers box. If that's not what you're looking for, you need to describe what your goal is. You might also give more of your table structure since you're asking about joins. kgt Mark Sargent wrote: Hi All, with wanting to show both product types(Switch, Router etc) and Makers(Cisco, Avaya, etc) on the one page in select boxes, I was wondering, do you use 2 seperate queries to the database or do you inner join to get all in 1..? I have set up different tables with related id's etc. So, to get Products.product_name and Products.product_id along with what the below query pulls, what wold be best..? I believe if I do a 2nd query, than some variables need to be identified with the particular query, yes..? Cheers. html body hr h1 align=centerJUMBO STATUS/h1p centerUsed Hardware Specialist/center hr h2 align=centerAdmin/h2 table align=center border=2 tr tdh3 align=centerPRODUCT TYPE/h3/td /tr trtdcenter select name=poduct_type ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail, ProductTypes.product_type_id FROM ProductTypes,$db); $num = mysql_num_rows($result); for ($i=0; $i$num; $i++){ $myrow=mysql_fetch_array($result); $product_type=mysql_result($result,$i,product_type_detail); $product_type_id=mysql_result($result,$i,product_type_id); echo option value=\$product_type_id\$product_type/optionbr; } ? /select /center /td/tr /table p p p hrcenteremail: [EMAIL PROTECTED]p Telephone: 03-5209-1777p Fax: 03-5209-2539 /center hr /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XSL:FO + PHP
Dan, I'm glad this may work for you. As far as the speed: it's of course difficult to judge, and I certainly didn't test it under any real load, but I had no problems creating and serving a several page document with graphics in it. We were testing the concept of something like this for a system with a non-public system, so weren't overlly concerned about testing the efficiency of this, especially since this wasn't to be our final approach. I'd be interested if you find out more information on the subject. On using passthru: I do not think FOP has the option to passthru the PDF output from the command line call. It was necessary to save the generated PDF and then serve it. (I haven't double checked, but I think I saved the file because I had to.) Of course FOP is open source so you have the opportunity to make it work with you. kgt Dan Rossi wrote: On 05/05/2005, at 1:47 AM, Kristen G. Thorson wrote: Dan, I have done this before, but it was only a proof-of concept excercise for me, so my procedure may not work for you. My test was against an Amazon web service and generating a PDF from the XML returned to me. This method used Apache's FOP. Before executing the following code, I saved the XML returned from Amazon as a temp file ($xmlfile). $PDFfile = $xmlfile.pdf; $callstring = $FOPpath/fop.sh -xsl $xslforoot/$xslfofile -xml $xmlfile -pdf $PDFfile; $answer = shell_exec( $callstring ); header( Content-type: $ctype ); $pieces = explode( /, $xmlfile ); header( Content-Disposition: attachment; filename=.$pieces[ count( $pieces )-1 ] ); readfile( $xmlfile.pdf ); I hope this is helpful to you, kgt Hi yes this is exactly what i may have to do. I have tried all the usual outlets in terms of subclasses of FPDF , all are limited and crappy, it just cant do tables properly. The closest I got was with PDML however it was still tedious to build a table with ! Now I think processing for such a command line would take forever this is what I need to do, a print button displays on the header of a form entry. What i need to do is collect the data from that database entry and display it as a view with the data rather than the form and make it printable in a pdf. This ideally means generate xml from the db entry, save it as a file, execute commandline with temp xml file, readfile the pdf. I dont think it should take too long to output to the browser right ? I think a step i'd like to skip is the readfile, and work out how to send to standard output and use passthru ? In the past I have used an app called HTMLDoc, its the bomb for making pdf manuals with chapters and table of contents. It also requires saving a temp html file and then sends the pdf as standard output. However HTMLDoc is not free anymore, I only have one licence for that to make docs only. . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XSL:FO + PHP
Dan Rossi wrote: On 05/05/2005, at 5:57 AM, Kristen G. Thorson wrote: especially since this wasn't to be our final approach. I'd be interested if you find out more information on the subject. What did you decide on ? LOL. That part got beyond me. I don't understand how all the PDF forms stuff works, and I wasn't a part of the implementation of it. Something like XML + FDF = PDF. We decided against using the XSL:FO because we needed to create a form, but this form had an exact layout that we would need to emulate, and the other way was the path of least resistance. kgt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php