[PHP] Rate to charge
I have been asked to look in toprogramming a PHP system for someone, and while I have been programming for a while this will be the first time it will be for someone other then a friend. Just wanted to get some ideas on how much you charge for program PHP/Mysql. Any ideas on how to charge would be great. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Rate to charge
timothy johnson wrote: I have been asked to look in toprogramming a PHP system for someone, and while I have been programming for a while this will be the first time it will be for someone other then a friend. Just wanted to get some ideas on how much you charge for program PHP/Mysql. Any ideas on how to charge would be great. Thanks I'm in New Zealand and charge NZ$50/hour as a base rate for PHP web development. I don't know what that is in your currency, try www.xe.com/ucc to find out. It's really up to you, though, and how much you value your time. Also take into account your expertise in PHP and MySQL, and in the problem domain. If you do not have a lot of expertise in either of those areas then you may not want to charge as highly. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Rate to charge
Jasper Bryant-Greene wrote: timothy johnson wrote: I have been asked to look in toprogramming a PHP system for someone, and while I have been programming for a while this will be the first time it will be for someone other then a friend. Just wanted to get some ideas on how much you charge for program PHP/Mysql. Any ideas on how to charge would be great. Thanks I'm in New Zealand and charge NZ$50/hour as a base rate for PHP web development. I don't know what that is in your currency, try www.xe.com/ucc to find out. That's almost probably as cheap as india. It's really up to you, though, and how much you value your time. Also take into account your expertise in PHP and MySQL, and in the problem domain. If you do not have a lot of expertise in either of those areas then you may not want to charge as highly. Jasper I agree, it really depends on your (proffessional) experience, and expertise and even the client. I think I started at 25 euro and for my last clients I charged somewhere between 75 and 100 euro. I usually charge more for bigger corporations, because they tend to whine a lot more, and you'll always end up spending twice as much time as expected. One thing I learned. It's better to charge 100 dollars per hour and say you need 50 hours, instead of charging 50 hours and say it will take 100. Evert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Rate to charge
Evert | Rooftop wrote: Jasper Bryant-Greene wrote: I'm in New Zealand and charge NZ$50/hour as a base rate for PHP web development. I don't know what that is in your currency, try www.xe.com/ucc to find out. That's almost probably as cheap as india. True, but markets are different in different countries. More to the point, it's not bad for a first-year student, at least here in New Zealand! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Rate to charge
Jasper Bryant-Greene wrote: Evert | Rooftop wrote: Jasper Bryant-Greene wrote: I'm in New Zealand and charge NZ$50/hour as a base rate for PHP web development. I don't know what that is in your currency, try www.xe.com/ucc to find out. That's almost probably as cheap as india. True, but markets are different in different countries. More to the point, it's not bad for a first-year student, at least here in New Zealand! Hm now I read it it sounds kinda rude, I'm sorry for that.. Yea it's all we all start right =) Good luck to you in the future Evert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX PHP
On Thu, Jul 21, 2005 at 11:22:25AM +0530, balwant singh wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. I haven't tried it myself, but this looks rather good, article on how to implement Google Suggest in PHP: http://tinyurl.com/dxs8b Paul -- Rogue Tory http://www.roguetory.org.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX PHP
Yeah, AJAX is really going to change the way web applications are made... I've messed around with the tutorials with it... I've also seen it referred to as XMLHttpRequest .. I think the AJAX class transforms your PHP functions into javascript... seems like the class is just made to for people like me who are heavy with PHP... but don't have a clue about javascript... from my impression you need to be able to have a tiny bit of javascript programming skill to really put it to use... do a search on google for XMLHttpRequest PHP Tutorial .. there is a lot there Good Luck.. Joe On 7/21/05, Paul Waring [EMAIL PROTECTED] wrote: On Thu, Jul 21, 2005 at 11:22:25AM +0530, balwant singh wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. I haven't tried it myself, but this looks rather good, article on how to implement Google Suggest in PHP: http://tinyurl.com/dxs8b Paul -- Rogue Tory http://www.roguetory.org.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson
[PHP] Re: how to check for a static call from an object
Sebastian Mendel wrote: Hi, how can i check if a method is called statically when called from inside another object? (without debug_bactrace()) class foo { function bar() { if ( isset( $this ) ) { return 'not static'; } return 'static'; } function bar2() { foo::bar(); } } sorry, my mistake // returns 'static' echo foo::bar(); // returns 'not static' but should be 'static' $foo = new foo; echo $foo-bar2(); so, how can i prevent a method from called static or not called static? and btw. does anynone know why it is not good to let one function handle both mehtods of calling (static and not static) as in PHP 5 you will get notices if called wrong - but PHP doesnt support multiple function-definitions like: class foo { static function bar() { return ANY_DEFAULT_VALUE; } function bar() { return $this-value; } } or even class foo { static function bar( $param ) { return $param; } function bar() { return $this-param; } } or is this at least an issue for the internals-list? -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Howto connect to the internet using php
Is there any way for me to use php to make my windows xp pc connect to the internet, either by starting the windows dialer or by some other means? The windows machine uses a standard 56k dialup to connect to the internet. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rate to charge
timothy johnson wrote: I have been asked to look in toprogramming a PHP system for someone, and while I have been programming for a while this will be the first time it will be for someone other then a friend. Just wanted to get some ideas on how much you charge for program PHP/Mysql. Any ideas on how to charge would be great. Thanks I charge $50/hr. Be very careful when you specify a timeline, it will always take at least 10-25% more than you estimate! It's better to over estimate and complete earlier. At least it makes you look good ;) Good Luck! Matt Darby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howto connect to the internet using php
Hi It may posible with .Net and COM functions, I think. see : http://www.php.net/manual/en/ref.com.php Best Regards -Cafer Prş, 2005-07-21 tarihinde 12:10 +0200 saatinde, Steven yazdı: Is there any way for me to use php to make my windows xp pc connect to the internet, either by starting the windows dialer or by some other means? The windows machine uses a standard 56k dialup to connect to the internet. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howto connect to the internet using php
On Thu, 2005-07-21 at 12:10 +0200, Steven wrote: Is there any way for me to use php to make my windows xp pc connect to the internet, either by starting the windows dialer or by some other means? The windows machine uses a standard 56k dialup to connect to the internet. Thanks Steve There might be a way of doing it through rundll32, although I'm not sure wich. On the php side, once you uncovered how to do it, you would just exec() / system() the function :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] gloabl reference behavior question?
On 20 July 2005 23:40, Surendra Singhi wrote: Hello, (1) When I try this code: ?php $var_global = stuff; function f1() { global $var_global; This is equivalent to creating a $var_global which is local to the function, and making it be a reference to the global $var_global -- effectively: $var_global = $GLOBALS['var_global']; $var_local = array(1,2); $var_global = $var_local; But this assigns a new reference to $var_local to the (local) $var_global, thus breaking the reference to the (global) $var_global -- so the (global) $var_global isn't changed by this assignment. } Thus, when the function returns, the (local) $var_global disappears, and the (global) $var_global comes back into scope with its value unchanged. f1(); print_r($var_global); I get the output: stuff where as I was expecting junk value or null. My question is that, because the array is created locally and we pass it by reference (without copying) so on the exit of function, its value is lost, but how does the global variable gets back its old value? See description above. Is it something which is not defined by the PHP language reference and is implementation specific? No this is described in the manual at http://php.net/global#language.variables.scope.references To do what you're trying to do, you should make use of the $GLOBALS superglobal: $GLOBALS['var_global'] = $var_local; But that seems very dodgy -- and, since $var_local disappears when the function returns anyway, why not just: $GLOBALS['var_global'] = array(1,2); Overall, I'd be somewhat suspicious about what your function is trying to do, as the whole approach seems rather convoluted to me. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howto connect to the internet using php
On Thu, 2005-07-21 at 12:10 +0200, Steven wrote: Is there any way for me to use php to make my windows xp pc connect to the internet, either by starting the windows dialer or by some other means? The windows machine uses a standard 56k dialup to connect to the internet. Thanks Steve http://www.dx21.com/SCRIPTING/RUNDLL32/VIEWITEM.ASP?OID=126CMD=P-A :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howto connect to the internet using php
Steven wrote: Is there any way for me to use php to make my windows xp pc connect to the internet, either by starting the windows dialer or by some other means? The windows machine uses a standard 56k dialup to connect to the internet. Thanks Steve If you have your machine already set-up to connect automatically to the internet (i.e. when your browser is started) then all that is necessary is to execute something that needs an internet connection - for example you could CURL a web page. Mind you, if you had done a 2 minute google, maybe you would have found: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rasdial.mspx HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: still some problems with contact form
Hello Mark An alternative (and more user-friendly) approach is to have the form's action as itself (i.e. the form on contact.php submits to contact.php). You can then identify which fields are incomplete and highlight them in the form. This will make it easier for users to see what they have done wrong and make the necessary corrections. in regards to this response on my contact form issues, how would I do these which you mention. currentlly the form is: form method=post action=Thankyou.php class=info_request and the Thankyou.php code consit of what I posted on the forum. thanks for all of your help!! A sample set up is as follows, with much room for improvement and refinement, but it should give you the basic idea. contact.php ?php #check that the form has been posted $email=isset($_POST['email'])?$_POST['email']:''; $emailerror=false; if($email!=''){ #basic validation passed, so redirect header(Location: Thankyou.php); }else{ $emailerror=true; }? emailbr form method=post action=contact.php class=info_request input type=text name=email value=?=$email;? ? if($_POST){ #show the input with a red background if the form has been posted and if($emailerror==true)print 'style=background-color:red;'; } ? input type=submit value=submit /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Content Header
Christopher J. Umina wrote: I currently have a script which streams data out of a MySQL database, and prints the content headers correctly, however, when I use the following line: header(Content-Disposition: attachment; filename=\. $filename .\); it prompts the user to download the file each time they go to the site. Then it works. :-) It sounds like you meant to use inline instead of attachment. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class/Function Query Call Problem
I'm creating a psuedo mail/message app for users to send messages to one another. For this, I've created a parent class, class.members.php, and an extended class, class.mail.php. The problem I'm having is when I make page which calls the classes members and memberMail creates an infite loop; however, if I bypass the classes and do the mysqli functions directly on the page, I get the right output. There is only one record in the database; fnGetMailCount() produces one record and fnGetMail() using 'return $query-num_rows' produces one record. I'm assuming there's something with my while loop, but I've used this method for other query output without issue. One other note, I've also tested by removing all session variables and hard coding values instead and received the same results. Also, the database variables are stored in an array in _global.php which is included in the output page. I apologize if these are basic questions, but while I'm learning, I would prefer to learn properly instead of coding a bunch of junk just for the sake of getting it done quickly (please let me know if I'm heading down that path). Under class.members.php I've created the constructor to initialize the database vars. class members { var $iMemberID; var $iProfileID; var $_iMemberID; var $_iProfileID; var $mysqli; var $query; function members($dbServer, $dbUser, $dbPassword,$dbDSN){ $this-_dbServer = $dbServer; $this-_dbUser = $dbUser; $this-_dbPassword = $dbPassword; $this-_dbDSN = $dbDSN; } [...] } Under class.mail.php I've extended members(): class memberMail extends members { var $iMailID; function memberMail(){ parent::members(); } function fnGetMailCount() { $sql = SELECT iMessageID FROM tblEmail WHERE iToMemberID = . $this-getMemberID(); $mysqli = new mysqli($this-_dbServer, $this-_dbUser,$this-_dbPassword, $this-_dbDSN); $query = $mysqli-query($sql); return $query-num_rows; } function fnGetMail() { $sql = SELECT * FROM tblEmail WHERE iToMemberID = . $this-getMemberID() . Order by dtEmailDate Desc; $mysqli = new mysqli($this-_dbServer, $this-_dbUser, $this-_dbPassword, $this-_dbDSN); $query = $mysqli-query($sql); return $query-fetch_object(); //return $query-num_rows; //return $query-fetch_assoc(); } [] } Output/calling page: ? require_once(../../classes/class.members.php); require_once(../../classes/class.mail.php); session_start(); require_once(../../_global.php); //$objMember = new members(); //intialize member class $objMail = new memberMail(); //initialize memberMail class $objMail-members($aSiteSettings[sDBServer],$aSiteSettings[sDBLogin],$aSiteSettings[sDBPassword], $aSiteSettings[sDSN]); $objMail-setMemberID($_SESSION[iMemberID]); $iMailCount = $objMail-fnGetMailCount(); while($rows=$objMail-fnGetMail()){ print_r($rows-sTitle); } /* // Test mysqli directly on page - same as fnGetMail() $sql = SELECT * FROM tblEmail WHERE iToMemberID = . $_SESSION[iMemberID] . Order by dtEmailDate Desc; $mysqli = new mysqli($aSiteSettings[sDBServer], $aSiteSettings[sDBLogin], $aSiteSettings[sDBPassword], $aSiteSettings[sDSN]); $query = $mysqli-query($sql); while($rows = $query-fetch_object()){ print_r($rows-sTitle); } $mysqli-close; */ ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX PHP
We had a webcast on PHP and Ajax a while back--the recordings are still available for free at http://blogs.phparch.com/mt/index.php?p=49. Also you may want to try looking for Ajax here: http://beeblex.com/ajax (it's a new search engine I just put online, so I thought I'd take the opportunity for some shameless self-promotion). Cheers! Marco On 7/21/05 1:52 AM, balwant singh [EMAIL PROTECTED] wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. With Best Wishes Balwant Singh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Character Encoding problem
Whenever I switch the encoding of a page to UTF-8, the characters ñ, ë, ì, û, á, etc., automatically changes to question marks. I've originally set the encoding of a page to ISO-8859-1 using header () function. header ('Content-Type: text/html; charset=ISO-8859-1'); Does anybody know how to solve this problem of mine? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX PHP
Started playing with it about two months and have now integrated it into my project. Makes things a lot easier and much more dynamic. No more round trips to the server just to mark an action as completed or other simple things that normally required a refresh. You can do dynamic lookups based on what's entered in a field, without having to download all the information in javascript variables. A big bonus is that communication with the server can be done asynchronously, so the user still has complete control while you're doing lookups or whatever. I found it extremely simple to implement, although I'm returning text strings at the moment instead of XML. Not completely up to speed on parsing XML in javascript. You just pass a URL to the server, which would be a PHP file along with parameters. The only thing PHP is doing is 'echo'ing some data back to the client. A javascript function can then do something with that data. So you do need to have some javascript skills. The xmlHttpPost function I use I found on O'Reilly: http://www.onlamp.com/pub/a/onlamp/2005/05/19/xmlhttprequest.html On Jul 21, 2005, at 1:52 AM, balwant singh wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. With Best Wishes Balwant Singh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Character Encoding problem
On 7/21/05 8:32 AM, Regine Velasquez [EMAIL PROTECTED] wrote: Whenever I switch the encoding of a page to UTF-8, the characters ñ, ë, ì, û, á, etc., automatically changes to question marks. I've originally set the encoding of a page to ISO-8859-1 using header () function. header ('Content-Type: text/html; charset=ISO-8859-1'); Well, if you've set the encoding to ISO-8859-1 and then output utf-8 characters I would expect them not to display properly. Or am I not understanding the problem correctly? From what I see, you can either change the encoding of the page, or use a function like utf8_decode() to transform utf-8 characters into iso-8859-1 (which, of course, is not always possible). Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] objects destroyed in same order as created?
Jasper, I would have thought php would have called the destructors on each of the classes in a LIFO fashion, but if it doesn't, just use unset() as a workaround, where you can remove the classes in the order you want. C. -Original Message- From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] Sent: 21 July 2005 05:45 To: php-general@lists.php.net Subject: [PHP] objects destroyed in same order as created? * This e-mail has been received by the Revenue Internet e-mail service. * Hi all I am currently working on a PHP 5 application. For the sake of simplicity, I'll only describe 3 classes here, as that is all that is required for you to see my problem. I have a DB class that interacts with the database, a Session class that controls the session with the user, and a User class that stores the information about the logged-in user. I create instances of these classes in the order [DB, Session, User] at request startup. They have to be in this order as the Session and User classes need the database, and the User class needs the session. The User and Session destructors both need the database to write any changed information back to the database, but it seems that the destructors are called in the order that the objects are created, so the database is taken down first. Wouldn't it make more sense for just about all applications to destroy objects in the reverse order that they were created? Is there any way to work around this? Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service *
[PHP] mail will not send attachment
Please help, I need the body of this email to be sent as HTML and have the attachment go with it (a pdf from my HD) but it doesn't want to send. R. ?php include ('connect.php'); global $mail_to, $mail_cc, $mail_bcc, $mail_from, $mail_reply_to; global $mail_body, $mail_subject; global $userfile, $userfile_type, $userfile_name, $userfile_size; global $mail_type, $mail_headers, $mail_charset, $mail_encoding, $people; if (isset($people)) { if ($people == everyone){ $query = SELECT * FROM $table_name; $result= mysql_query($query); while ($row=mysql_fetch_array($result)) { $email_addresses[] = $row['email']; //$mail_to = [EMAIL PROTECTED]; } } //$count = count($email_addresses); //$mail_to = implode(', ', $email_addresses); /*this counts the number of entries echo $count; echo $recipients;*/ if ($people == 2){ //echo by location; } if ($people == byjob){ $mail_to = [EMAIL PROTECTED]; } } if (isset($SUBMIT)) { if (empty($mail_to)){ ? script alert ('You have not entered the recipients email address') /script ? } else { // send the mail $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $mail_body = str_replace(\r\n, BR, $mail_text); if(!empty($mail_from)) $mail_headers .= From: $mail_from\n; if(!empty($mail_reply_to)) $mail_headers .= Reply-to: $mail_reply_to\n; if(!empty($mail_cc)) $mail_headers .= Cc: . str_replace(;, ,, $mail_cc) . \n; if(!empty($mail_bcc)) $mail_headers .= Bcc: . str_replace(;, ,, $mail_bcc) . \n; $mail_subject = stripslashes($mail_subject); $mail_body = stripslashes($mail_body); $fp = fopen($userfile, r); $file = fread($fp, filesize($userfile)); $file = chunk_split(base64_encode($file)); $mail_body = trtd width=\314\div align=\center\img src=\http://www.scottishsocialnetworks.org/ssn_logo3.gif\; width=\100\ height=\139\/div/td/tr; $mail_body .= BRBRBRBR; $mail_body .= font size=\2\ face=\Verdana, Arial, Helvetica, sans-serif\$mail_text /font; $mail_body .= BRBRBRBRBR; $mail_body .= tr td width=\662\div align=\center\font size=\1\ face=\Verdana, Arial, Helvetica, sans-serif\55 Albany Street, Edinburgh, EH1 3QY, t: 0131 524 9869, EXC 0131 557 4059, f: 0131 524 9860/font/div/td /tr tr td width=\662\div align=\center\font size=\1\ face=\Verdana, Arial, Helvetica, sans-serif\e: [EMAIL PROTECTED], Web: scottishsocialnetworks.org/font/div/td /tr; $mail_body .= BR; $mail_body .= tr td width=\662\div align=\center\font size=\2\ face=\Verdana, Arial, Helvetica, sans-serif\A project managed by the Rock Trust Charity No. SC018708 and supported by Communities Scotland/span/div/td /tr; mail( $mail_to, $mail_subject, $mail_body, $headers); ? script alert ('Your email has been sucessfully sent') /script ? } } ? HTML HEADTITLEE-mailer/TITLE script function ddd() { document.ross.submit() } /script !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html!-- InstanceBegin template=Templates/ssn.dwt codeOutsideHTMLIsLocked=false -- head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 !-- InstanceBeginEditable name=doctitle -- titleUntitled Document/title !-- InstanceEndEditable -- !-- InstanceBeginEditable name=head -- style type=text/css !-- .style6 {font-family: Arial, Helvetica, sans-serif; font-size: 12px;} -- /style !-- InstanceEndEditable -- style type=text/css !-- .style1 {font-size: 12px} .style7 {font-size: 10; } .style8 {font-size: 9px; } -- /style link href=ssn.css rel=stylesheet type=text/css style type=text/css !-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #00; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } -- /style/head body table width=950 height=506 border=0 align=center cellpadding=0 cellspacing=0 tr td width=126 height=355 align=left valign=toptable width=126 border=0 align=center cellpadding=5 tr tdimg src=ssn_logo3.gif width=100 height=139/td /tr tr td width=116div align=centera href=mailer.phpMail a newsletter /a/div/td /tr tr tddiv align=centera href=add_contact.phpAdd a new contact/a /div/td /tr tr tddiv align=centera href=editor.phpEdit Database/a /div/td /tr tr tdnbsp;/td /tr tr tdnbsp;/td /tr /table/td td width=894 valign=topdiv align=center !-- InstanceBeginEditable name=EditRegion3 -- FORM ACTION=?php $PHP_SELF; ? METHOD=POST ENCTYPE=MULTIPART/FORM-DATA name=ross id=ross div align=left p INPUT TYPE=HIDDEN NAME=action VALUE=send_mail /p pnbsp; /p
[PHP] GET form method and accessing its value into a cookie
Hi I have a page which generates 'edit' links (used to edit user details). The code snippet on the 'list_user.php' page is; --- $print_rows .=tr class=\stdtablecells\ \n. td{$details['name']}/td \n. td{$details['mail']}/td \n. td{$details['quota']}/td \n. tda href=\edit_user.php?user={$user_list[$i]['uid'][0]}\edit/a/td \n. /tr \n; --- The line in question really is this one; a href=\edit_user.php?user={$user_list[$i]['uid'][0]}\edit/a/td \n. As you can see this creates a link to the 'edit_user.php' page with a GET parameter generated by a php array. The 'edit_user.php' page contains this script (before any headers are generated) which is designed to put the GET value into a cookie; --- if (! isset($_COOKIE['yhgfluseruid'])) { $useruid = $_REQUEST['user']; setcookie('yhgfluseruid', $useruid); } --- What happens when actually viewing the pages in a browser, is that the url is generated (seemingly) correctly, for example; http://localhost/emailadmin/src/[EMAIL PROTECTED] The only problem is the $user variable doesn't seem to read the cookie, or the cookie doesn't get generated before the rest of the page is generated and the users details are blank. BUT if I refresh the page, everything is fine. Also, if I go back to the 'list_user.php' page, and try editing a different user, although the URL suggests that it's passing the correct parameters, I end up seeing the details of the previous user? Help please (sorry for the long description - I am just trying to be accurate) Regards Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GET form method and accessing its value into a cookie
Hi I have a page which generates 'edit' links (used to edit user details). The code snippet on the 'list_user.php' page is; --- $print_rows .=tr class=\stdtablecells\ \n. td{$details['name']}/td \n. td{$details['mail']}/td \n. td{$details['quota']}/td \n. tda href=\edit_user.php?user={$user_list[$i]['uid'][0]}\edit/a/td \n. /tr \n; --- The line in question really is this one; a href=\edit_user.php?user={$user_list[$i]['uid'][0]}\edit/a/td \n. As you can see this creates a link to the 'edit_user.php' page with a GET parameter generated by a php array. The 'edit_user.php' page contains this script (before any headers are generated) which is designed to put the GET value into a cookie; --- if (! isset($_COOKIE['yhgfluseruid'])) { $useruid = $_REQUEST['user']; setcookie('yhgfluseruid', $useruid); } --- What happens when actually viewing the pages in a browser, is that the url is generated (seemingly) correctly, for example; http://localhost/emailadmin/src/[EMAIL PROTECTED] The only problem is the $user variable doesn't seem to read the cookie, or the cookie doesn't get generated before the rest of the page is generated and the users details are blank. BUT if I refresh the page, everything is fine. Also, if I go back to the 'list_user.php' page, and try editing a different user, although the URL suggests that it's passing the correct parameters, I end up seeing the details of the previous user? Help please (sorry for the long description - I am just trying to be accurate) Regards Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX PHP
I've been tinkering with AJAX for a few weeks now. I've used it in a simple user registration system form. Instead of submitting a desired username and waiting for a round trip to the server to verify that the username is not already in use, I used AJAX to perform the DB query in the background without a browser refresh. It is pretty slick, using a little CSS and javascript the user gets instant notification (onblur) that their selected username is already in use or is verified and okay before submitting the rest of the form. I implemented this with XML, however, only to learn, not because the functionality required it. I've also accumulated some links to resources: http://www.ajaxmatters.com http://www.ajaxpatterns.org http://adaptivepath.com/publications/essays/archives/000385.php (This is the essay that coined the term 'AJAX') http://www.ajaxian.com The above links all have good collections of links to further resources. Good Luck, ... Benjamin Liu On Jul 21, 2005, at 1:52 AM, balwant singh wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. With Best Wishes Balwant Singh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail will not send attachment
Try http://phpmailer.sourceforge.net/ Works awesomelly great. I've been using it for quite some time now, and I don't want to look at mail() again :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] db insert question
Im using mysql with PHP4, whats the best way to insert as many as 20 records at one time from a form? Currently im just assigning each one a variable but that is messy and takes ages, is their a way to loop over the array of form data then maybe do the same to enter it into a database? Thanks for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] db insert question
Im using mysql with PHP4, whats the best way to insert as many as 20 records at one time from a form? Currently im just assigning each one a variable but that is messy and takes ages, is their a way to loop over the array of form data then maybe do the same to enter it into a database? Thanks for any help. A generic question begs a generic answer: foreach($formdata as $thisdata){ $result=mysql_query(insert into ... values($thisdata) where ...); } Hope this helps, but it would be useful to have code examples, etc so that a more relevant answer could be rendered. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET form method and accessing its value into a cookie
Cookies will not become visible until the next loading of a page. Assign the data to a variable at the same time it is assigned to a cookie and call the variable to make the data visible on the first page. Cookies must be deleted with the same parameters as they were set with. Check you new data against the contents of the cookie, if they are different, delete the cookie and assign the new cookie (also remember to assign to the first page variable). Read this: http://us2.php.net/manual/en/function.setcookie.php Mark Cain - Original Message - From: Steve Turnbull [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thursday, July 21, 2005 5:38 AM Subject: [PHP] GET form method and accessing its value into a cookie Hi I have a page which generates 'edit' links (used to edit user details). The code snippet on the 'list_user.php' page is; --- $print_rows .= tr class=\stdtablecells\ \n. td{$details['name']}/td \n. td{$details['mail']}/td \n. td{$details['quota']}/td \n. tda href=\edit_user.php?user={$user_list[$i]['uid'][0]}\edit/a/td \n. /tr \n; --- The line in question really is this one; a href=\edit_user.php?user={$user_list[$i]['uid'][0]}\edit/a/td \n. As you can see this creates a link to the 'edit_user.php' page with a GET parameter generated by a php array. The 'edit_user.php' page contains this script (before any headers are generated) which is designed to put the GET value into a cookie; --- if (! isset($_COOKIE['yhgfluseruid'])) { $useruid = $_REQUEST['user']; setcookie('yhgfluseruid', $useruid); } --- What happens when actually viewing the pages in a browser, is that the url is generated (seemingly) correctly, for example; http://localhost/emailadmin/src/[EMAIL PROTECTED] The only problem is the $user variable doesn't seem to read the cookie, or the cookie doesn't get generated before the rest of the page is generated and the users details are blank. BUT if I refresh the page, everything is fine. Also, if I go back to the 'list_user.php' page, and try editing a different user, although the URL suggests that it's passing the correct parameters, I end up seeing the details of the previous user? Help please (sorry for the long description - I am just trying to be accurate) Regards Steve -- 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] db insert question
Thanks for your reply, your example demonstrates what i was doing but does that do a MySQL query for every piece of data? So 20 form values would be 20 db queries, would that not consume a lot of resources? Is their another way? Thanks, James Jim Moseby wrote: Im using mysql with PHP4, whats the best way to insert as many as 20 records at one time from a form? Currently im just assigning each one a variable but that is messy and takes ages, is their a way to loop over the array of form data then maybe do the same to enter it into a database? Thanks for any help. A generic question begs a generic answer: foreach($formdata as $thisdata){ $result=mysql_query(insert into ... values($thisdata) where ...); } Hope this helps, but it would be useful to have code examples, etc so that a more relevant answer could be rendered. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] db insert question
Jim Moseby wrote: Im using mysql with PHP4, whats the best way to insert as many as 20 records at one time from a form? Currently im just assigning each one a variable but that is messy and takes ages, is their a way to loop over the array of form data then maybe do the same to enter it into a database? Thanks for any help. A generic question begs a generic answer: foreach($formdata as $thisdata){ $result=mysql_query(insert into ... values($thisdata) where ...); } Hope this helps, but it would be useful to have code examples, etc so that a more relevant answer could be rendered. JM Thanks for your reply, your example demonstrates what i was doing but does that do a MySQL query for every piece of data? So 20 form values would be 20 db queries, would that not consume a lot of resources? Is their another way? As far as I know, there is no way to insert 20 unique rows of data into a MySQL table without executing 20 queries. Maybe someone else here does(?). Perhaps drop a note over on the MySQL list, since this is really more an SQL question than PHP. Sorry I couldn't help. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] db insert question
On Thursday 21 July 2005 15:02, Jim Moseby typed: As far as I know, there is no way to insert 20 unique rows of data into a MySQL table without executing 20 queries. Maybe someone else here does(?). Perhaps drop a note over on the MySQL list, since this is really more an SQL question than PHP. Sorry I couldn't help. Yes, MySQL supports an extended insert syntax of insert into foo (...) values (...), (...), (...). Building that kind of query is left as an excercise for the user. I believe the PEAR DB abstraction layer can accept an array to generate that kind of query. -- My mind not only wanders, it sometimes leaves completely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] db insert question
Hi You may try sending multiple query with one mysql_query() function call via seperating by ;. Regards. -Cafer Prş, 2005-07-21 tarihinde 10:02 -0400 saatinde, Jim Moseby yazdı: Jim Moseby wrote: Im using mysql with PHP4, whats the best way to insert as many as 20 records at one time from a form? Currently im just assigning each one a variable but that is messy and takes ages, is their a way to loop over the array of form data then maybe do the same to enter it into a database? Thanks for any help. A generic question begs a generic answer: foreach($formdata as $thisdata){ $result=mysql_query(insert into ... values($thisdata) where ...); } Hope this helps, but it would be useful to have code examples, etc so that a more relevant answer could be rendered. JM Thanks for your reply, your example demonstrates what i was doing but does that do a MySQL query for every piece of data? So 20 form values would be 20 db queries, would that not consume a lot of resources? Is their another way? As far as I know, there is no way to insert 20 unique rows of data into a MySQL table without executing 20 queries. Maybe someone else here does(?). Perhaps drop a note over on the MySQL list, since this is really more an SQL question than PHP. Sorry I couldn't help. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] db insert question
On Thursday 21 July 2005 15:02, Jim Moseby typed: As far as I know, there is no way to insert 20 unique rows of data into a MySQL table without executing 20 queries. Maybe someone else here does(?). Perhaps drop a note over on the MySQL list, since this is really more an SQL question than PHP. Sorry I couldn't help. Yes, MySQL supports an extended insert syntax of insert into foo (...) values (...), (...), (...). Interesting! Consulting the manual, I see that you are correct. So the OP would do something like: $sql=insert into foo values ; foreach($formdata as $thisdata){ $sql.=($thisdata,...,...,...),; } $result=mysql_query($sql); (of course the above code is broken, because it would leave an extra comma at the end, but this is the general idea, no?) JM == learns something new from this list every day! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] db insert question
* JamesBenson [EMAIL PROTECTED] : Thanks for your reply, your example demonstrates what i was doing but does that do a MySQL query for every piece of data? So 20 form values would be 20 db queries, would that not consume a lot of resources? Not necessarily. If you use a prepared statement first, then execute it, you'll get excellent performance. If you're interested in prepared statements, or don't know what they are, look at DB abstraction layers like PEAR::DB, PEAR:MDB(2), and ADODB -- they utilize them. As an example: $sql = INSERT INTO someTable(field1, field2, ...) VALUES (?, ?, ...); $insert = $db-prepare($sql); foreach ($data as $vals) { $db-execute($insert, $vals); // Assuming each element of $data // is an array of values } Basically, you prepare a SQL statement that contains placeholders for the values. Then when executing the statement, you pass an array of values equal to the number of placeholders in the statement. The benefits are (a) speed, and (b) security. Regarding (b), the values are quoted in a proper format for your RDBMS, so you don't need to worry about escaping each and every value -- the DB abstraction layer and/or the RDBMS takes care of it for you. Is their another way? Yes -- Build your SQL first, in the following format: INSERT INTO someTable(field1, field2, ...) VALUES ('rec1Field1', 'rec1Field2', ...), ('rec2Field1', 'rec2Field2', ...), ('rec3Field1', 'rec3Field2', ...); And some PHP code that could help create this: // Beginning of SQL $sql = INSERT INTO someTable(field1, field2, ...) VALUES ; // Loop through records to insert $INS = array(); foreach ($data as $values) { $final = array(); // Loop through each value in the record and quote it foreach ($values as $val) { $final[] = sprintf('%s', mysql_real_escape_string($val)); } // Join them with commas and enclose all in () $INS[] = '(' . implode(',', $final) . ')'; } // Finally, join all the records with commas, and end the SQL with a // semicolon $sql .= implode(',', $INS) . ';'; $result = mysql_query($sql); HTH... Jim Moseby wrote: Im using mysql with PHP4, whats the best way to insert as many as 20 records at one time from a form? Currently im just assigning each one a variable but that is messy and takes ages, is their a way to loop over the array of form data then maybe do the same to enter it into a database? Thanks for any help. A generic question begs a generic answer: foreach($formdata as $thisdata){ $result=mysql_query(insert into ... values($thisdata) where ...); } Hope this helps, but it would be useful to have code examples, etc so that a more relevant answer could be rendered. -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] db insert question
On Thursday 21 July 2005 15:23, Jim Moseby typed: Yes, MySQL supports an extended insert syntax of insert into foo (...) values (...), (...), (...). Interesting! Consulting the manual, I see that you are correct. So the OP would do something like: $sql=insert into foo values ; foreach($formdata as $thisdata){ $sql.=($thisdata,...,...,...),; } $result=mysql_query($sql); (of course the above code is broken, because it would leave an extra comma at the end, but this is the general idea, no?) Vaguely, yes. The trick here is that any single failure in one of the columns can leave you with inconsistent data. Thus, use this with InnoDB table and transactions enabled so you can rollback on failure :) For sake of correctness, the data should be checked for validity first. Then, assuming that all of the form data is going into the same table as the same fields, you could push ($variable1, $variable2) into an array, and join(',', $that_array) Presto, no extra comma. Should use the mysql escape stuff too if not using an abstraction layer that deals with it for you. -- My mind not only wanders, it sometimes leaves completely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] db insert question
Thanks for all your help, ive got it working as i needed, my db query is built like this, works but probably not the best way of doing it:- $sqlStart = INSERT INTO `tester` (; $sqlMiddle = ) VALUES (; $sqlEnd = ); $keys = array(); $values = array(); foreach($formData as $keyName = $keyValue){ array_push($keys, `$keyName`); array_push($values, '$keyValue'); } $keys = implode(,, $keys); $values = implode(,, $values); $query = $sqlStart$keys$sqlMiddle$values$sqlEnd; $result = mysql_query($query); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Attaching a PDF in email (no body text displays)
I am attaching a PDF document to an email, this part works great, however to get this to work it prevents the text in the body of the message to be displayed, what am I doing wrong? Here is the code: $filename = confirmation.pdf; if(!($fp = fopen($filename, r))): $error = Can't open file; echo $error; exit; endif; $boundary = b . md5(uniqid(time())); $boundary=''.$boundary.''; $attach = fread($fp, filesize($filename)); $attach = chunk_split(base64_encode($attach)); $mime = from: [EMAIL PROTECTED]; $mime .= Content-type: multipart/mixed; boundary=$boundary; $mime .= --$boundary\r\n; $mime .= Content-type: application/pdf; name=\confirmation.pdf\\r\n; $mime .= Content-Transfer-Encoding: base64\r\n\r\n; $mime .= Content-Disposition: attachment;\r\n; $mime .= \r\n$attach\n; $mime .= --$boundary\r\n; $mime .= Content-Type: text/HTML; charset=iso-8859-1\r\n; $mime .= Content-Transfer-Encoding: 7bit\r\n\r\n; $mime .= test test test; $mime .= --$boundary--\r\n; mail([EMAIL PROTECTED],Your Confirmation: $confirmation_number,,$mime);
RE: [PHP] Attaching a pdf in email (no body text displays)
SOMEONE ANSWERED THIS FOR YOU I've attached some comments inline. Ade Smith wrote: I am attaching a PDF document to an email, this part works great, however to get this to work it prevents the text in the body of the message to be displayed, what am I doing wrong? Here is the code $filename = confirmation.pdf; if(!($fp = fopen($filename, r))): $error = Can't open file; echo $error; exit; endif; $boundary = b . md5(uniqid(time())); $boundary=''.$boundary.''; $attach = fread($fp, filesize($filename)); $attach = chunk_split(base64_encode($attach)); $mime = from: [EMAIL PROTECTED]; $mime .= Content-type: multipart/mixed; boundary=$boundary; $mime .= --$boundary\r\n; $mime .= Content-type: application/pdf; name=\confirmation.pdf\\r\n; $mime .= Content-Transfer-Encoding: base64\r\n\r\n; $mime .= Content-Disposition: attachment;\r\n; $mime .= \r\n\r\n$attach\n; It's been while, but shouldn't this line read: $mime .= \r\n$attach\r\n; Just to ensure that no extra characters get included witht he file? I don't think it matters much with PDFs, but it would definitely break other files. $mime .= --$boundary\r\n; $mime .= Content-Type: text/HTML; charset=iso-8859-1\r\n; $mime .= Content-Transfer-Encoding: 7bit\r\n\r\n; $mime .= test test test; $mime .= --$boundary\r\n; You forgot the trailing -- here, so this line should read: $mime .= --$boundary--\r\n; Otherwise the mail clients assume there is another part to the MIME message (which defaults to empty). And the last part is always the one that is intended to be viewed. , So it displays the empty one. mail([EMAIL PROTECTED],Your Confirmation: $confirmation_number,test test test test test,$mime); Once again, it's been awhile, but I believe the best way to do this is to put only the main body headers into the header variable ($mime in this case), and put the parts in the body So the body itself is split into the parts. This is probably contributing to the problem as well. Chris -- 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] Attaching a pdf in email (no body text displays)
Unfortunately their suggestion did not work. -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Thursday, July 21, 2005 11:28 AM To: PHP - General Subject: RE: [PHP] Attaching a pdf in email (no body text displays) SOMEONE ANSWERED THIS FOR YOU I've attached some comments inline. Ade Smith wrote: I am attaching a PDF document to an email, this part works great, however to get this to work it prevents the text in the body of the message to be displayed, what am I doing wrong? Here is the code $filename = confirmation.pdf; if(!($fp = fopen($filename, r))): $error = Can't open file; echo $error; exit; endif; $boundary = b . md5(uniqid(time())); $boundary=''.$boundary.''; $attach = fread($fp, filesize($filename)); $attach = chunk_split(base64_encode($attach)); $mime = from: [EMAIL PROTECTED]; $mime .= Content-type: multipart/mixed; boundary=$boundary; $mime .= --$boundary\r\n; $mime .= Content-type: application/pdf; name=\confirmation.pdf\\r\n; $mime .= Content-Transfer-Encoding: base64\r\n\r\n; $mime .= Content-Disposition: attachment;\r\n; $mime .= \r\n\r\n$attach\n; It's been while, but shouldn't this line read: $mime .= \r\n$attach\r\n; Just to ensure that no extra characters get included witht he file? I don't think it matters much with PDFs, but it would definitely break other files. $mime .= --$boundary\r\n; $mime .= Content-Type: text/HTML; charset=iso-8859-1\r\n; $mime .= Content-Transfer-Encoding: 7bit\r\n\r\n; $mime .= test test test; $mime .= --$boundary\r\n; You forgot the trailing -- here, so this line should read: $mime .= --$boundary--\r\n; Otherwise the mail clients assume there is another part to the MIME message (which defaults to empty). And the last part is always the one that is intended to be viewed. , So it displays the empty one. mail([EMAIL PROTECTED],Your Confirmation: $confirmation_number,test test test test test,$mime); Once again, it's been awhile, but I believe the best way to do this is to put only the main body headers into the header variable ($mime in this case), and put the parts in the body So the body itself is split into the parts. This is probably contributing to the problem as well. Chris -- 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] Attaching a pdf in email (no body text displays)
[snip] Unfortunately their suggestion did not work. [/snip] Then, instead of just reposting your original message, let us know that it didn't work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Attaching a pdf in email (no body text displays)
[snip] Then, instead of just reposting your original message, let us know that it didn't work. [/snip] Forgot to say that there is a tutorial on http://www.zend.com by Coggershall telling how to do e-mail with attachements. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howto connect to the internet using php
cant u use the exec() function to call system commands... Steven wrote: Is there any way for me to use php to make my windows xp pc connect to the internet, either by starting the windows dialer or by some other means? The windows machine uses a standard 56k dialup to connect to the internet. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] iconv trouble on OS X
I wrote this question then found out where the problem was, so this is just for the archives... == I've compiled PHP 5.0.4 successfully on OS X 10.4.2, but I'm getting a weird problem with iconv. I specified it in my configure line: --with-iconv and it seems to pick it up ok while configuring: checking for iconv support... yes checking for libiconv in -liconv... yes checking if iconv is Konstantin Chuguev's... no checking if iconv supports errno... yes It builds OK too. php thinks that the iconv extension is there: php -m|grep iconv iconv The entry in phpinfo() is rather suspicious: iconv support = enabled iconv implementation = unknown iconv library version = unknown Then in one script I get: Fatal error: Call to undefined function iconv() and function_exists('iconv') returns false. I've also tried specifying --with-iconv=/sw (i.e. using libiconv-1.9.2-11 from fink), but I get the same results. The solution lies in the user notes for iconv() where someone mentions: elk at NOSPAMmodel-fx dot com 26-Jul-2002 04:07 If you use the libiconv library instead of the libc's iconv support, don't forget to use libiconv() instead of iconv() And it really is as simple as that - just substitute libiconv() for iconv() - it seems that libiconv is the default on OS X. I think this is a terrible implementation (clearly PHP itself is confused by it, 3 years on from this note) and I've no idea why it was done that way, but now at least someone can find out easily. Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gloabl reference behavior question?
Ford, Mike [EMAIL PROTECTED] writes: On 20 July 2005 23:40, Surendra Singhi wrote: Thanks, for explaining it. (1) When I try this code: ?php $var_global = stuff; function f1() { global $var_global; This is equivalent to creating a $var_global which is local to the function, and making it be a reference to the global $var_global -- effectively: $var_global = $GLOBALS['var_global']; $var_local = array(1,2); $var_global = $var_local; But this assigns a new reference to $var_local to the (local) $var_global, thus breaking the reference to the (global) $var_global -- so the (global) $var_global isn't changed by this assignment. To do what you're trying to do, you should make use of the $GLOBALS superglobal: $GLOBALS['var_global'] = $var_local; Or may I suggest, what I am currently doing (in a much more complex code) $var_global = $var_local; Thanks. -- Surendra Singhi http://www.spikesource.com http://www.public.asu.edu/~sksinghi/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rate to charge
I have been asked to look in toprogramming a PHP system for someone, and while I have been programming for a while this will be the first time it will be for someone other then a friend. Just wanted to get some ideas on how much you charge for program PHP/Mysql. Any ideas on how to charge would be great. Thanks I found this to be an interesting read... while it doesn't specifically address your question, it covers a lot of consulting related issues (hourly, fixed bid, client management, etc.) It's worth spending the time to read... http://www.unixwiz.net/techtips/be-consultant.html -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attaching a PDF in email (no body text displays)
Personally I use the MimeMail class, that works a treat, http://www.phpguru.org/static/mime.mail.html Their are two versions, one php4 one php5, or install via pear. JB Ade Smith wrote: I am attaching a PDF document to an email, this part works great, however to get this to work it prevents the text in the body of the message to be displayed, what am I doing wrong? Here is the code: $filename = confirmation.pdf; if(!($fp = fopen($filename, r))): $error = Can't open file; echo $error; exit; endif; $boundary = b . md5(uniqid(time())); $boundary=''.$boundary.''; $attach = fread($fp, filesize($filename)); $attach = chunk_split(base64_encode($attach)); $mime = from: [EMAIL PROTECTED]; $mime .= Content-type: multipart/mixed; boundary=$boundary; $mime .= --$boundary\r\n; $mime .= Content-type: application/pdf; name=\confirmation.pdf\\r\n; $mime .= Content-Transfer-Encoding: base64\r\n\r\n; $mime .= Content-Disposition: attachment;\r\n; $mime .= \r\n$attach\n; $mime .= --$boundary\r\n; $mime .= Content-Type: text/HTML; charset=iso-8859-1\r\n; $mime .= Content-Transfer-Encoding: 7bit\r\n\r\n; $mime .= test test test; $mime .= --$boundary--\r\n; mail([EMAIL PROTECTED],Your Confirmation: $confirmation_number,,$mime); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attaching a PDF in email (no body text displays)
Ade Smith wrote: I am attaching a PDF document to an email, this part works great, however to get this to work it prevents the text in the body of the message to be displayed, what am I doing wrong? Here is the code: $filename = confirmation.pdf; if(!($fp = fopen($filename, r))): $error = Can't open file; echo $error; exit; endif; $boundary = b . md5(uniqid(time())); $boundary=''.$boundary.''; $attach = fread($fp, filesize($filename)); $attach = chunk_split(base64_encode($attach)); $mime = from: [EMAIL PROTECTED]; $mime .= Content-type: multipart/mixed; boundary=$boundary; $mime .= --$boundary\r\n; $mime .= Content-type: application/pdf; name=\confirmation.pdf\\r\n; $mime .= Content-Transfer-Encoding: base64\r\n\r\n; $mime .= Content-Disposition: attachment;\r\n; $mime .= \r\n$attach\n; $mime .= --$boundary\r\n; $mime .= Content-Type: text/HTML; charset=iso-8859-1\r\n; $mime .= Content-Transfer-Encoding: 7bit\r\n\r\n; $mime .= test test test; $mime .= --$boundary--\r\n; mail([EMAIL PROTECTED],Your Confirmation: $confirmation_number,,$mime); You have nothing in the body part of the mail function http://us2.php.net/manual/en/function.mail.php mail($to, $subject, $message, $headers); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attaching a PDF in email (no body text displays)
sorry, i think i misunderstood his problem. I didn't get the replies to his original post until after I sent mine jzf Joseph wrote: Ade Smith wrote: I am attaching a PDF document to an email, this part works great, however to get this to work it prevents the text in the body of the message to be displayed, what am I doing wrong? Here is the code: $filename = confirmation.pdf; if(!($fp = fopen($filename, r))): $error = Can't open file; echo $error; exit; endif; $boundary = b . md5(uniqid(time())); $boundary=''.$boundary.''; $attach = fread($fp, filesize($filename)); $attach = chunk_split(base64_encode($attach)); $mime = from: [EMAIL PROTECTED]; $mime .= Content-type: multipart/mixed; boundary=$boundary; $mime .= --$boundary\r\n; $mime .= Content-type: application/pdf; name=\confirmation.pdf\\r\n; $mime .= Content-Transfer-Encoding: base64\r\n\r\n; $mime .= Content-Disposition: attachment;\r\n; $mime .= \r\n$attach\n; $mime .= --$boundary\r\n; $mime .= Content-Type: text/HTML; charset=iso-8859-1\r\n; $mime .= Content-Transfer-Encoding: 7bit\r\n\r\n; $mime .= test test test; $mime .= --$boundary--\r\n; mail([EMAIL PROTECTED],Your Confirmation: $confirmation_number,,$mime); You have nothing in the body part of the mail function http://us2.php.net/manual/en/function.mail.php mail($to, $subject, $message, $headers); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gzuncompress mysql blob field
Heya guys, I've ran into a problem that I just can't seem to get around. Basically I am storing file contents in a compressed format (gzcompress -at 9) in my database -- why -- basically to affect a search of said content using keywords retrieved via an input source (it could be any, doesn't really matter). Anyways, all works fine, until the blob size reaches about 64kb, then my script (and box) just completely crap out -- the page eventually gets forwarded to a page cannot be found after a while (and this is even if I have set my max_execution_time to like 5 seconds). Ok, so I theorized it may be a memory consumption problem, so I played around with the memory_limit directive in upwards of 100mg, and I still get the problem. It's very wierd.. it works just fine if the blob size is below 64kb, but just craps out when it is =. Oh yeah, xp box. Thanks in advance, Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Loading dynamic extension
Hi, ive got two hard questions for you guys. 1. I'm trying to load an extension dynamically using DL(): if(!extension_loaded('gtk')){ dl('php_gtk.'.PHP_SHLIB_SUFFIX); } The problem with this is that i can't load the extension correctly since the software is running from a USBKEY. These removable medias do not necessarely always have the same drive letter and i can't ask people to copy the software on their machine since the software will write back on the key at a specific location. 2. Further more, i can't seem to find a way to know from which path or drive my usbkey is operating. There is maybe something i missed somewhere that's why im asking. Anyone ever found something about the CLI current run path in $_ENV or $_SERVER var? Mathieu Dumoulin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gzuncompress mysql blob field
Still playing around.. if I remove the gzuncompress function.. it works perfectly. hmm.. it looks something like this $resultRecords = 2-dimensional set of associative records from database query (i use the pear db class) foreach ($resultRecords as $record) { $fileContent = gzuncompress ($record[compress_content]); // this statement causes problems when compress content 64kb $fileContent = $record[compress_content]; // this statement works just dandy } Christian Calloway [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Heya guys, I've ran into a problem that I just can't seem to get around. Basically I am storing file contents in a compressed format (gzcompress -at 9) in my database -- why -- basically to affect a search of said content using keywords retrieved via an input source (it could be any, doesn't really matter). Anyways, all works fine, until the blob size reaches about 64kb, then my script (and box) just completely crap out -- the page eventually gets forwarded to a page cannot be found after a while (and this is even if I have set my max_execution_time to like 5 seconds). Ok, so I theorized it may be a memory consumption problem, so I played around with the memory_limit directive in upwards of 100mg, and I still get the problem. It's very wierd.. it works just fine if the blob size is below 64kb, but just craps out when it is =. Oh yeah, xp box. Thanks in advance, Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] $this availability inside static-functions
Sean Coates wrote: how can i check if a method is called statically when called from inside another object? (without debug_bactrace()) plug type=ownhttp://blog.phpdoc.info/archives/4-Schizophrenic-Methods.html/plug Short answer: $isStatic = !(isset($this) get_class($this) == __CLASS__); HTH S In the case of his example this will not work, as the static function call is coming from the same class, which probably doesn't happen in real code, but this isn't a complete solution(I don't know that there is one). But to answer the other question: does anyone know why it is not good to let one function handle both methods of calling (static and not static) as in PHP 5 you will get notices if called wrong A static method is a static method. You should call it statically. It has no meaning as an instance method, because the method returns the same results regardless of object state. So, even if you have an instance of an object, you should still call the method statically. Then again, it is a notice, which could safely be ignored(although I don't like to). but PHP doesnt support multiple function-definitions like: class foo { static function bar() { return ANY_DEFAULT_VALUE; } function bar() { return $this-value; } } This seems like it might be useful, but I don't know how possible/clean this is. It would solve your problem though. I imagine someone out there has something to say about how this should be done. I assume you want to allow users of the class to use the class statically, and use default values, or use an instance of the class to change defaults. What is the best way to get this done. And I think I'll move this reply to php-generals instead of here. John LeSueur -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gzuncompress mysql blob field
Ahh I think I got it.. max field size reached Christian Calloway [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Heya guys, I've ran into a problem that I just can't seem to get around. Basically I am storing file contents in a compressed format (gzcompress -at 9) in my database -- why -- basically to affect a search of said content using keywords retrieved via an input source (it could be any, doesn't really matter). Anyways, all works fine, until the blob size reaches about 64kb, then my script (and box) just completely crap out -- the page eventually gets forwarded to a page cannot be found after a while (and this is even if I have set my max_execution_time to like 5 seconds). Ok, so I theorized it may be a memory consumption problem, so I played around with the memory_limit directive in upwards of 100mg, and I still get the problem. It's very wierd.. it works just fine if the blob size is below 64kb, but just craps out when it is =. Oh yeah, xp box. Thanks in advance, Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with a home-grown function
Hello, all - I've been looking around for a function that would tell me if a $value in a $key=$value array was empty, and I could not find one. So I decided to make my own. Even if I am re-inventing the wheel, I thought that the practice might be good for me. However, my function doesn't *quite* work, and I'm having a difficult time finding out why. The code is as follows: function findMissingVals($workingArray) { $newcount = count($workingArray); for ($i = 0; $i = $newcount; $i++) { if (empty($workingArray['$i'])) { return 1; } } } So it takes in $workingArray as an array, runs a loop, checks $i, yada yada. The thing is, that sometimes the function does not return 1, even when it should. I was hoping some experienced eyes could take a gander at this and give me some pointers. Thanks! -dant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with a home-grown function
From: Dan Trainor [mailto:[EMAIL PROTECTED] Hello, all - I've been looking around for a function that would tell me if a $value in a $key=$value array was empty, and I could not find one. So I decided to make my own. Even if I am re-inventing the wheel, I thought that the practice might be good for me. However, my function doesn't *quite* work, and I'm having a difficult time finding out why. The code is as follows: function findMissingVals($workingArray) { $newcount = count($workingArray); for ($i = 0; $i = $newcount; $i++) { if (empty($workingArray['$i'])) { return 1; } } } So it takes in $workingArray as an array, runs a loop, checks $i, yada yada. The thing is, that sometimes the function does not return 1, even when it should. I was hoping some experienced eyes could take a gander at this and give me some pointers. PHP doesn't eval code in single-quotes, so what you want to do is simply: if (empty($workingArray[$i])) { return 1; } With the single-quotes, it's looking for the string $i as a key. HTH! -- Mike Johnson Smarter Living, Inc. Web Developerwww.smartertravel.com [EMAIL PROTECTED] (617) 886-5539 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with a home-grown function
Mike Johnson wrote: From: Dan Trainor [mailto:[EMAIL PROTECTED] Hello, all - I've been looking around for a function that would tell me if a $value in a $key=$value array was empty, and I could not find one. So I decided to make my own. Even if I am re-inventing the wheel, I thought that the practice might be good for me. However, my function doesn't *quite* work, and I'm having a difficult time finding out why. The code is as follows: function findMissingVals($workingArray) { $newcount = count($workingArray); for ($i = 0; $i = $newcount; $i++) { if (empty($workingArray['$i'])) { return 1; } } } So it takes in $workingArray as an array, runs a loop, checks $i, yada yada. The thing is, that sometimes the function does not return 1, even when it should. I was hoping some experienced eyes could take a gander at this and give me some pointers. PHP doesn't eval code in single-quotes, so what you want to do is simply: if (empty($workingArray[$i])) { return 1; } With the single-quotes, it's looking for the string $i as a key. HTH! Hey there, Mike - Your tips were very helpful, thank you. I saw my error, but I am still having problems. Being somewhat novice to PHP, I think my error might very well just be in my implementation of the function, as follows: function findMissingVals($workingArray) { $newcount = count($workingArray); for ($i = 0; $i = $newcount; $i++) { if (empty($workingArray[$i])) { return 1; } } } if (findMissingVals($vars)) { if (!$var1) { ? hi1 ? }; if (!$var2) { ? hi2 ? }; if (!$var3) { ? hi3 ? }; if (!$var4) { ? hi4 ? }; if (!$var5) { ? hi5 ? }; if (!$var6) { ? hi6 ? }; } else { echo hi; } I never see hi, even if I have an array as $vars as such: $vars = array(one,two,,four,five); so I'm a bit confused. If you wouldn't mind taking another few minutes here, I would greatly appreciate it. Thanks! -dant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session help!?
Hey, I have a site where I am using session_start() at the beginning of each page. The session id is passed transparently from the first page but after that it dissapears from the links and I lose all my session variables. Is there something elementary I'm missing? This is my first stab at PHP so I could be overlooking something really obvious or not really understanding how its supposed to work. The trans_id thingy is enabled by the way. Thanx in advance, Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with a home-grown function
Dan Trainor wrote: Mike Johnson wrote: From: Dan Trainor [mailto:[EMAIL PROTECTED] Hello, all - I've been looking around for a function that would tell me if a $value in a $key=$value array was empty, and I could not find one. So I decided to make my own. Even if I am re-inventing the wheel, I thought that the practice might be good for me. However, my function doesn't *quite* work, and I'm having a difficult time finding out why. The code is as follows: function findMissingVals($workingArray) { $newcount = count($workingArray); for ($i = 0; $i = $newcount; $i++) { if (empty($workingArray['$i'])) { return 1; } } } So it takes in $workingArray as an array, runs a loop, checks $i, yada yada. The thing is, that sometimes the function does not return 1, even when it should. I was hoping some experienced eyes could take a gander at this and give me some pointers. PHP doesn't eval code in single-quotes, so what you want to do is simply: if (empty($workingArray[$i])) { return 1; } With the single-quotes, it's looking for the string $i as a key. HTH! Hey there, Mike - Your tips were very helpful, thank you. I saw my error, but I am still having problems. Being somewhat novice to PHP, I think my error might very well just be in my implementation of the function, as follows: function findMissingVals($workingArray) { $newcount = count($workingArray); for ($i = 0; $i = $newcount; $i++) { if (empty($workingArray[$i])) { return 1; } } } if (findMissingVals($vars)) { if (!$var1) { ? hi1 ? }; if (!$var2) { ? hi2 ? }; if (!$var3) { ? hi3 ? }; if (!$var4) { ? hi4 ? }; if (!$var5) { ? hi5 ? }; if (!$var6) { ? hi6 ? }; } else { echo hi; } I never see hi, even if I have an array as $vars as such: $vars = array(one,two,,four,five); so I'm a bit confused. If you wouldn't mind taking another few minutes here, I would greatly appreciate it. Thanks! -dant Er, sorry about that - I never see hi even if an array is set as such: $vars = array(one,two,three,four,five); but I do see hi3 if I have an array set as such: $vars = array(one,two,,four,five); Thanks! -dant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] objects destroyed in same order as created?
Shaw, Chris - Accenture wrote: Jasper, I would have thought php would have called the destructors on each of the classes in a LIFO fashion, but if it doesn't, just use unset() as a workaround, where you can remove the classes in the order you want. I should add that this behaviour seems to have appeared in PHP 5.1.0b (this application will be released after PHP 5.1.0, so I'm developing it for that version). Maybe related to http://bugs.php.net/33772 ? It's a pain to have to unset() the classes manually as this is a large application, but I guess it's either that, downgrade to 5.0, or wait for a fix... Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Handling Recommendations
Hi all, I need to manage some records with dates. mmdd I'm putting select options breaking the three up in numeric pull downs. no problem gathering and storing the data in my mysql db as integers then posting them for existing records etc. i know their is a datetime datatype but it doesnt seem easier to use this data type than using integers...any tips or routines for handling this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with a home-grown function
Dan Trainor mailto:[EMAIL PROTECTED] on Thursday, July 21, 2005 2:03 PM said: I never see hi even if an array is set as such: $vars = array(one,two,three,four,five); That's because your function always returns true. If it finds a missing value it returns true. If it doesn't find a missing value it returns true. Because of this the true code block is always executed. You should do this instead: function hasMissingVals($input) { // make sure we've been passed an array with values if(is_array($input) (count($input) 0)) { foreach($input as $v) { if(empty($v)) { return true; } } } return false; } This way your function will always return false unless it finds a missing value in which case it will return true. As you can see I changed the name slightly from 'findMissingVals()' to 'hasMissingVals()' since your function is not actually finding any missing values. Finding suggests that your function will return data based on the location of the missing value which it does not do. if (findMissingVals($vars)) { if (!$var1) { ? hi1 ? }; if (!$var2) { ? hi2 ? }; if (!$var3) { ? hi3 ? }; if (!$var4) { ? hi4 ? }; if (!$var5) { ? hi5 ? }; if (!$var6) { ? hi6 ? }; } else { echo hi; } 1. Where are $var1, $var2, $var3, etc. coming from? I think you mean to write $var[1], $var[2], $var[3], etc.? 2. It will be a good idea to get out of the habit of breaking in and out of PHP like that. Instead just do: echo 'hi1'; You'll have problems down the road with modifying the headers (cookies, redirects, content-type, etc.) if you break in and out. Hope this helps, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [install] [curl] cannot finish ./configure
Hi guys, i tried to add curl support to my php-4.3.11, and now with new php-4.4.0, and i can't finish ./configure. i run debian woody with some backports (curl and libcurl are one of them). command line: ./configure --with-apxs=/usr/local/apache/bin/apxs --with-curl [and other --with] here is the result: [...] checking for CURL support... yes checking for CURL in default path... found in /usr checking for cURL 7.9.8 or greater... configure: error: cURL version 7.9.8 or later is required to compile php with cURL support 21:09 ulyze php-4.4.0% curl --version curl 7.13.2 (i386-pc-linux-gnu) libcurl/7.13.2 OpenSSL/0.9.6c zlib/1.1.4 Protocols: ftp gopher telnet dict ldap http file https ftps Features: IPv6 Largefile NTLM SSL libz as you can see, my curl is recent enough. one would say that ./configure compares versions as strings, and obviously 7.9xx 7.1xx ! what's the problem ? shall i forget the use of curl ? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with a home-grown function
Chris W. Parker wrote: Dan Trainor mailto:[EMAIL PROTECTED] on Thursday, July 21, 2005 2:03 PM said: I never see hi even if an array is set as such: $vars = array(one,two,three,four,five); That's because your function always returns true. If it finds a missing value it returns true. If it doesn't find a missing value it returns true. Because of this the true code block is always executed. You should do this instead: function hasMissingVals($input) { // make sure we've been passed an array with values if(is_array($input) (count($input) 0)) { foreach($input as $v) { if(empty($v)) { return true; } } } return false; } This way your function will always return false unless it finds a missing value in which case it will return true. As you can see I changed the name slightly from 'findMissingVals()' to 'hasMissingVals()' since your function is not actually finding any missing values. Finding suggests that your function will return data based on the location of the missing value which it does not do. if (findMissingVals($vars)) { if (!$var1) { ? hi1 ? }; if (!$var2) { ? hi2 ? }; if (!$var3) { ? hi3 ? }; if (!$var4) { ? hi4 ? }; if (!$var5) { ? hi5 ? }; if (!$var6) { ? hi6 ? }; } else { echo hi; } 1. Where are $var1, $var2, $var3, etc. coming from? I think you mean to write $var[1], $var[2], $var[3], etc.? 2. It will be a good idea to get out of the habit of breaking in and out of PHP like that. Instead just do: echo 'hi1'; You'll have problems down the road with modifying the headers (cookies, redirects, content-type, etc.) if you break in and out. Hope this helps, Chris. Hello, Chris - I see what you're saying about always returning true. I really understand now. I'd just like to take a minute to tell you thanks for the help. Thanks! -dant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Handling Recommendations
Hi all, I need to manage some records with dates. mmdd I'm putting select options breaking the three up in numeric pull downs. no problem gathering and storing the data in my mysql db as integers then posting them for existing records etc. i know their is a datetime datatype but it doesnt seem easier to use this data type than using integers...any tips or routines for handling this? It is much much easier to use at least the DATE type in your database. What if, six months from now you want to select all records that occured on even numbered Tuesdays? How would you do that if all you have is integers? I suppose you could look at every single row and do the math in PHP, but that's going to be a pain and won't scale very well... Good luck! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Handling Recommendations
Hi all, I need to manage some records with dates. mmdd I'm putting select options breaking the three up in numeric pull downs. no problem gathering and storing the data in my mysql db as integers then posting them for existing records etc. i know their is a datetime datatype but it doesnt seem easier to use this data type than using integers...any tips or routines for handling this? I guess this is my day to be dense, but I don't really understand the question. One part I think I understand is that you don't see the benefit to using the DATE datatype to store your dates. The DATE datatype allows you to do many things with dates that would be difficult storing them as integers. For instance, what would you have to do to get the day of the week for a day 66 days prior to the stored date? If your date was stored in a DATE field, all you would have to do is: $result=mysql_query(SELECT DATE_FORMAT(DATE_SUB(`stored_date`, interval 66 days) ,%W) from tablename where...); $row=mysql_fetch_row($result); echo The day if the week is .$row[0]; ...if your dates are stored in integer fields, how would you easily come about a similar result? JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [SPAM 6.0] [PHP] Session help!?
The biggest gotcha that I have ran into concerning sessions is this: If your client's browser is I.E. and the domain is named with _(underscores), -(dashes), etc. I.E. discards the session and starts a new one. I don't know if this is fixed under SP2. Example: a domain name http://my-domain.com will cause I.E. to lose sessions; however, there is a way around this if your are developing this for an internal website, you can simply add a host file record to utilize the actual IP. Example: http://my-domain.com225.225.225.1 If your client's browser is not I.E. then make sure all of your php.ini variables are as they need to be regarding sessions. Hope this helps. -Original Message- From: Richard Baldwin [mailto:[EMAIL PROTECTED] Sent: Friday, June 10, 2005 3:46 PM To: php-general@lists.php.net Subject: [SPAM 6.0] [PHP] Session help!? Hey, I have a site where I am using session_start() at the beginning of each page. The session id is passed transparently from the first page but after that it dissapears from the links and I lose all my session variables. Is there something elementary I'm missing? This is my first stab at PHP so I could be overlooking something really obvious or not really understanding how its supposed to work. The trans_id thingy is enabled by the way. Thanx in advance, Rich -- 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] Detecting case change?
Hi- how can I find the character postion in a string right before the first case change? Is there a function out there that already does this? E.g. passing the string WebApplication to this function would return the number 2. Thanks for any input. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting case change?
Hi- how can I find the character postion in a string right before the first case change? Is there a function out there that already does this? E.g. passing the string WebApplication to this function would return the number 2. Thanks for any input. I can't think of a function that does this, but something like this should work. Not sure how efficient it is to constantly call substr() on the string. Might be better to split it up into an array to start with. Or there might be a get character at function, but I don't see it right now... $word = WebApplication; $length = strlen($word); for ( $i = 1; $i $length; $i++ ) { $a = substr($word, $i - 1, 1); $b = substr($word, $i, 1); if ( ($a = 'a' $a = 'z' $b = 'A' $b = 'Z') || ($a = 'A' $a = 'Z' $b = 'a' $b = 'z') ) { // case change at $i which for $word would equal 1 (not 2) } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting case change?
On Thu, 2005-07-21 at 18:30, Philip Hallstrom wrote: Hi- how can I find the character postion in a string right before the first case change? Is there a function out there that already does this? E.g. passing the string WebApplication to this function would return the number 2. Thanks for any input. I can't think of a function that does this, but something like this should work. Not sure how efficient it is to constantly call substr() on the string. Might be better to split it up into an array to start with. Or there might be a get character at function, but I don't see it right now... $word = WebApplication; $length = strlen($word); for ( $i = 1; $i $length; $i++ ) { $a = substr($word, $i - 1, 1); $b = substr($word, $i, 1); Just in case you're not aware... you can loop over a strings characters using the string index notation: $length = strlen( $word ); for( $i = 1; $i $lengthl $i++ ) { $a = $word{$i - 1}; $b = $word{$i}; } Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Detecting case change?
That'll work- didn't realize you can compare strings like that in PHP- thanks guys. David -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Thursday, July 21, 2005 3:38 PM To: Philip Hallstrom Cc: David Yee; PHP-General Subject: Re: [PHP] Detecting case change? On Thu, 2005-07-21 at 18:30, Philip Hallstrom wrote: Hi- how can I find the character postion in a string right before the first case change? Is there a function out there that already does this? E.g. passing the string WebApplication to this function would return the number 2. Thanks for any input. I can't think of a function that does this, but something like this should work. Not sure how efficient it is to constantly call substr() on the string. Might be better to split it up into an array to start with. Or there might be a get character at function, but I don't see it right now... $word = WebApplication; $length = strlen($word); for ( $i = 1; $i $length; $i++ ) { $a = substr($word, $i - 1, 1); $b = substr($word, $i, 1); Just in case you're not aware... you can loop over a strings characters using the string index notation: $length = strlen( $word ); for( $i = 1; $i $lengthl $i++ ) { $a = $word{$i - 1}; $b = $word{$i}; } Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Handling Recommendations
Jim Moseby wrote: Hi all, I need to manage some records with dates. mmdd I'm putting select options breaking the three up in numeric pull [snip] For instance, what would you have to do to get the day of the week for a day 66 days prior to the stored date? If your date was stored in a DATE field, all you would have to do is: $result=mysql_query(SELECT DATE_FORMAT(DATE_SUB(`stored_date`, interval 66 days) ,%W) from tablename where...); $row=mysql_fetch_row($result); echo The day if the week is .$row[0]; ...if your dates are stored in integer fields, how would you easily come about a similar result? JM Um... Just because... $dayOfTheWeek = date(l, $dateFromDatabase - (66 * 86400)); *assuming by integer fields the OP is talking about unix timestamps* But you, and a previous poster, do bring up an interesting idea about this. I'd never thought about just how many different things you can do, or might need to do, with a DATE field in the database. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More toroughly checking a script before execution
Hi, is there a way to have a more torough checking of PHP code before executing? I can't remember the number of times when I try to read a variable which hasn't assigned a value yet. This increases as projects are getting bigger and more files are used. I know that due it's loosely typed nature, it wouldn't be possible to detect things like this: $foo = bar; $$foo = baz; echo $bar; but that would be okay with me. At least it should catch things like _before_ starting execution: - read variables not assigned a value before - verify that a function/method is actually defined I'm willing to accept a longer time PHP starting up because of this. I'm seeing it's main usefulness when using with the cli application to have it ran on code before it goes live or something. This would speed up testing dramatically, as it wouldn't be necessary to go through all test paths just to realize that a function/method call was misspelled or so. Basically it's like the compiling stage done in e.g. Java (oh no, did I wrote the J.. word? ;). I'm also aware that certain modern IDEs provide lookup features/introspecton at least for function/methods, but unfortunatley it's not everyones favourite. thanks for any pointers, - Markus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Rasmus' 30 second AJAX Tutorial - [was Re: [PHP] AJAX PHP]
I find a lot of this AJAX stuff a bit of a hype. Lots of people have been using similar things long before it became AJAX. And it really isn't as complicated as a lot of people make it out to be. Here is a simple example from one of my apps. First the Javascript: function createRequestObject() { var ro; var browser = navigator.appName; if(browser == Microsoft Internet Explorer){ ro = new ActiveXObject(Microsoft.XMLHTTP); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq(action) { http.open('get', 'rpc.php?action='+action); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); document.getElementById(update[0]).innerHTML = update[1]; } } } This creates a request object along with a send request and handle response function. So to actually use it, you could include this js in your page. Then to make one of these backend requests you would tie it to something. Like an onclick event or a straight href like this: a href=javascript:sndReq('foo')[foo]/a That means that when someone clicks on that link what actually happens is that a backend request to rpc.php?action=foo will be sent. In rpc.php you might have something like this: switch($_REQUEST['action']) { case 'foo': /* do something */ echo foo|foo done; break; ... } Now, look at handleResponse. It parses the foo|foo done string and splits it on the '|' and uses whatever is before the '|' as the dom element id in your page and the part after as the new innerHTML of that element. That means if you have a div tag like this in your page: div id=foo /div Once you click on that link, that will dynamically be changed to: div id=foo foo done /div That's all there is to it. Everything else is just building on top of this. Replacing my simple response id|text syntax with a richer XML format and makine the request much more complicated as well. Before you blindly install large AJAX libraries, have a go at rolling your own functionality so you know exactly how it works and you only make it as complicated as you need. Often you don't need much more than what I have shown here. Expanding this approach a bit to send multiple parameters in the request, for example, would be really simple. Something like: function sndReqArg(action,arg) { http.open('get', 'rpc.php?action='+action+'arg='+arg); http.onreadystatechange = handleResponse; http.send(null); } And your handleResponse can easily be expanded to do much more interesting things than just replacing the contents of a div. -Rasmus Joe Harman wrote: Yeah, AJAX is really going to change the way web applications are made... I've messed around with the tutorials with it... I've also seen it referred to as XMLHttpRequest .. I think the AJAX class transforms your PHP functions into javascript... seems like the class is just made to for people like me who are heavy with PHP... but don't have a clue about javascript... from my impression you need to be able to have a tiny bit of javascript programming skill to really put it to use... do a search on google for XMLHttpRequest PHP Tutorial .. there is a lot there Good Luck.. Joe On 7/21/05, Paul Waring [EMAIL PROTECTED] wrote: On Thu, Jul 21, 2005 at 11:22:25AM +0530, balwant singh wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. I haven't tried it myself, but this looks rather good, article on how to implement Google Suggest in PHP: http://tinyurl.com/dxs8b Paul -- Rogue Tory http://www.roguetory.org.uk -- 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] Date Handling Recommendations
thanks all. i just made the changes and its working smooth. i remember having a bunch of drama trying to use DATE data type...oh well, i just needed something to get me off my butt haha thanks again On 7/21/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Hi all, I need to manage some records with dates. mmdd I'm putting select options breaking the three up in numeric pull downs. no problem gathering and storing the data in my mysql db as integers then posting them for existing records etc. i know their is a datetime datatype but it doesnt seem easier to use this data type than using integers...any tips or routines for handling this? It is much much easier to use at least the DATE type in your database. What if, six months from now you want to select all records that occured on even numbered Tuesdays? How would you do that if all you have is integers? I suppose you could look at every single row and do the math in PHP, but that's going to be a pain and won't scale very well... Good luck! -- John Martinez http://www.funkyfreshdesigns.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More toroughly checking a script before execution
Markus Fischer wrote: Hi, is there a way to have a more torough checking of PHP code before executing? I can't remember the number of times when I try to read a variable which hasn't assigned a value yet. This increases as projects are getting bigger and more files are used. I know that due it's loosely typed nature, it wouldn't be possible to detect things like this: $foo = bar; $$foo = baz; echo $bar; but that would be okay with me. At least it should catch things like _before_ starting execution: - read variables not assigned a value before - verify that a function/method is actually defined I'm willing to accept a longer time PHP starting up because of this. I'm seeing it's main usefulness when using with the cli application to have it ran on code before it goes live or something. This would speed up testing dramatically, as it wouldn't be necessary to go through all test paths just to realize that a function/method call was misspelled or so. Basically it's like the compiling stage done in e.g. Java (oh no, did I wrote the J.. word? ;). I'm also aware that certain modern IDEs provide lookup features/introspecton at least for function/methods, but unfortunatley it's not everyones favourite. thanks for any pointers, - Markus Sounds like you just need to turn on E_NOTICE. At least for your variable access stuff assuming your test case actually hits that part of the code. If you are talking about complete code coverage letting you catch any such mistyped variables or functions, that is simply impossible to do at that level because variables and function names can be defined at runtime. Just because a function doesn't exist at compile time doesn't mean that it won't be created before the call to it at runtime. And it doesn't need to be as complicated as you make it out to be with your variable variable example. A simple conditional include completely changes the nature of everything at runtime. What you really need is to create decent regression tests and use a code coverage tool to make sure your tests cover your code well. Xdebug can do the code coverage check for you. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Rasmus' 30 second AJAX Tutorial - [was Re: [PHP] AJAX PHP]
Hey Rasmus, Well said! Thanks for the example to... I am sure I am going to refer to it more than a few times... The AJAX/XMLHttpRequest was more an ephiphony for me than anything else Since the only references I have that are related to PHP or any other server side scripting languages is (1) people on the list and my best friend, (2) the PHP manual... ;o) ..I wish I knew more developers out there... cause I tend to learn alot from working with others... and XMLHttpRequest would have came up alot sooner in my life!!! LOL I don't think I would use the AJAX library itself... but I will use the framework that it is based on... Thanks for taking the time to give us the example! Joe On 7/21/05, Rasmus Lerdorf [EMAIL PROTECTED] wrote: I find a lot of this AJAX stuff a bit of a hype. Lots of people have been using similar things long before it became AJAX. And it really isn't as complicated as a lot of people make it out to be. Here is a simple example from one of my apps. First the Javascript: function createRequestObject() { var ro; var browser = navigator.appName; if(browser == Microsoft Internet Explorer){ ro = new ActiveXObject(Microsoft.XMLHTTP); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq(action) { http.open('get', 'rpc.php?action='+action); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); document.getElementById(update[0]).innerHTML = update[1]; } } } This creates a request object along with a send request and handle response function. So to actually use it, you could include this js in your page. Then to make one of these backend requests you would tie it to something. Like an onclick event or a straight href like this: a href=javascript:sndReq('foo')[foo]/a That means that when someone clicks on that link what actually happens is that a backend request to rpc.php?action=foo will be sent. In rpc.php you might have something like this: switch($_REQUEST['action']) { case 'foo': /* do something */ echo foo|foo done; break; ... } Now, look at handleResponse. It parses the foo|foo done string and splits it on the '|' and uses whatever is before the '|' as the dom element id in your page and the part after as the new innerHTML of that element. That means if you have a div tag like this in your page: div id=foo /div Once you click on that link, that will dynamically be changed to: div id=foo foo done /div That's all there is to it. Everything else is just building on top of this. Replacing my simple response id|text syntax with a richer XML format and makine the request much more complicated as well. Before you blindly install large AJAX libraries, have a go at rolling your own functionality so you know exactly how it works and you only make it as complicated as you need. Often you don't need much more than what I have shown here. Expanding this approach a bit to send multiple parameters in the request, for example, would be really simple. Something like: function sndReqArg(action,arg) { http.open('get', 'rpc.php?action='+action+'arg='+arg); http.onreadystatechange = handleResponse; http.send(null); } And your handleResponse can easily be expanded to do much more interesting things than just replacing the contents of a div. -Rasmus Joe Harman wrote: Yeah, AJAX is really going to change the way web applications are made... I've messed around with the tutorials with it... I've also seen it referred to as XMLHttpRequest .. I think the AJAX class transforms your PHP functions into javascript... seems like the class is just made to for people like me who are heavy with PHP... but don't have a clue about javascript... from my impression you need to be able to have a tiny bit of javascript programming skill to really put it to use... do a search on google for XMLHttpRequest PHP Tutorial .. there is a lot there Good Luck.. Joe On 7/21/05, Paul Waring [EMAIL PROTECTED] wrote: On Thu, Jul 21, 2005 at 11:22:25AM +0530, balwant singh wrote: Have anybody tried PHP AJAX, may please share your experience. also pls. suggest good link of tutorial on this. I haven't tried it myself, but this looks rather good, article on how to implement Google Suggest in PHP: http://tinyurl.com/dxs8b Paul -- Rogue Tory http://www.roguetory.org.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson
[PHP] Affiliate Tracking [Management] program
I' looking for free PHP/MySQL Affiliate Tracking [Management] program. Would appreciate any advice/idea fd. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rasmus' 30 second AJAX Tutorial - [was Re: [PHP] AJAX PHP]
On Thu, July 21, 2005 3:50 pm, Rasmus Lerdorf said: I find a lot of this AJAX stuff a bit of a hype. Lots of people have been using similar things long before it became AJAX. And it really Call me silly, but... Didn't a LOT of us move a bunch of code to PHP instead of JS because JS was so flaky, because browser implementations were so... diverse..., because you never knew if the user even *HAD* javascript, really, and you just didn't want to rely on it? Is anybody going to claim that any of the fundamental problems with client-side scripting have changed? Got a bridge to sell, too? If it's just eye-candy, and doesn't matter to the functioning of your web-site, go for it. If you NEED it to work, JS is simply not the right way to go, even with today's landscape. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More toroughly checking a script before execution
On Thu, July 21, 2005 3:50 pm, Markus Fischer said: is there a way to have a more torough checking of PHP code before executing? Use E_ALL if you aren't already. Most people aren't because the default is E_ALL ~ E_NOTICE, which is a Big Mistake for a default, imnsho. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: [SPAM 6.0] [PHP] Session help!?
On Thu, July 21, 2005 2:21 pm, Programmer said: The biggest gotcha that I have ran into concerning sessions is this: If your client's browser is I.E. and the domain is named with _(underscores), -(dashes), etc. I.E. discards the session and starts a new one. I don't know if this is fixed under SP2. This cannot be true for many versions of IE... I would have noticed. :-) Though IE *is* giving me fits on this page: http://uncommonground.com/artist/ They login okay, but can't get to following pages. These are users for whom the question: what browser version do you have? yields answers like Windows 2000... Is it that goofy mini privacy policy crap? Like the bad guys won't just LIE. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading dynamic extension
On Thu, July 21, 2005 12:17 pm, Mathieu Dumoulin said: 2. Further more, i can't seem to find a way to know from which path or drive my usbkey is operating. There is maybe something i missed somewhere that's why im asking. Anyone ever found something about the CLI current run path in $_ENV or $_SERVER var? If your PHP script is on the same drive as the GTK lib, then you can use phpinfo() to find out the variable name that has your drive letter. Something like $script_filename or somesuch. Insert the USB device, note the drive letter, run php -i | grep X: Course, on a Mac or Linux box, your USB device won't have a drive letter per se -- You'll have the correct PATH though, for the OS it's on, which is far far more portable. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] db insert question
On Thu, July 21, 2005 6:52 am, JamesBenson said: Thanks for your reply, your example demonstrates what i was doing but does that do a MySQL query for every piece of data? So 20 form values would be 20 db queries, would that not consume a lot of resources? Is their another way? Test it on your server. 20 INSERTS is pretty much chump change, really... I mean, sure, if you're server is getting SLAMMED and you are executing this page a thousand times a day or something. Otherwise, your are really NOT looking at a lot of overhead for those 20 queries. Time It. I doubt that the prepared statements give much performance boost for only 20 queries, but, again, time it on YOUR computer. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Content Header
On Thu, July 21, 2005 4:55 am, Chris Shiflett said: Christopher J. Umina wrote: I currently have a script which streams data out of a MySQL database, and prints the content headers correctly, however, when I use the following line: header(Content-Disposition: attachment; filename=\. $filename .\); it prompts the user to download the file each time they go to the site. Then it works. :-) But it will only work on *SOME* browsers -- those which honor the johnny-come-lately Content-Disposition header. Use Content-type: application/octet-stream to guarantee it gets downloaded in ALL browsers. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about apache-php concurrent process control
I now encounter a problem with flow control of my program with PHP. This is very crucial to the design of a pretty big project. This is what I want to do in the program: ?php do_A(); header(Location: .$result_of_do_A); do_B(); ? Since it takes do_B() quite a while to finish, so I want the http client get the partial result from do_A() by redirect a page to them before start do_B(). But it seems that the redirection will only occure after the entire php program finishes, i.e., after do_B(). I sent http request through browser, curl comman line with -N (no buffer) option and with a perl LWP program I wrote. All of them suggest that header(), although is put before do_B() in code, gets executed only after all the php code finished. I add flush() after header() too, but no work. My question is: Is there any way that I can return to the client though http response and then continue my progress with my program? Thank you very much for your kindly help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about apache-php concurrent process control
http://ca.php.net/manual/en/function.register-shutdown-function.php Cheers, Rob. On Thu, 2005-07-21 at 23:40, Liang ZHONG wrote: I now encounter a problem with flow control of my program with PHP. This is very crucial to the design of a pretty big project. This is what I want to do in the program: ?php do_A(); header(Location: .$result_of_do_A); do_B(); ? Since it takes do_B() quite a while to finish, so I want the http client get the partial result from do_A() by redirect a page to them before start do_B(). But it seems that the redirection will only occure after the entire php program finishes, i.e., after do_B(). I sent http request through browser, curl comman line with -N (no buffer) option and with a perl LWP program I wrote. All of them suggest that header(), although is put before do_B() in code, gets executed only after all the php code finished. I add flush() after header() too, but no work. My question is: Is there any way that I can return to the client though http response and then continue my progress with my program? Thank you very much for your kindly help. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding ftp functionality into php
On 7/21/05, Tom Cruickshank [EMAIL PROTECTED] wrote: Hello, My apologizes in advance if this is the wrong mailing list. I have a php module in apache which is missing ftp functionality (--enable-ftp was not used as an argument on compile time). However, recompiling php at this time does not give me other options I am looking for. I would like to add php_ftp (or whatever the extension is called) as an extension in the /usr/local/etc/php/extensions.ini file did you went through this manual page? http://www.php.net/ftp http://www.php.net/manual/en/wrappers.ftp.php get a 'phpinfo()' output and look for the 'FTP' section, if it's enabled thats it!. i have used php ftp for few times, but had never required to configure or compile it specifically. correct me if i'm wrong. ~viraj. problem is, i can't seem to find it anywhere. would anyone know? Thanks for any assistance! Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about apache-php concurrent process control
On Thu, July 21, 2005 8:40 pm, Liang ZHONG said: I now encounter a problem with flow control of my program with PHP. This is very crucial to the design of a pretty big project. This is what I want to do in the program: ?php do_A(); header(Location: .$result_of_do_A); Depending on the buffering options in php.ini and/or Apache, this may or may not just end your program, as I understand it. Once you send the Location header, everything else is irrelevant, or at least not reliable. You could do: echo $result_of_do_A; flush(); and the user will see what happened with A, while waiting for B. do_B(); ? Since it takes do_B() quite a while to finish, so I want the http client get the partial result from do_A() by redirect a page to them before start do_B(). But it seems that the redirection will only occure after the entire php program finishes, i.e., after do_B(). I sent http request through browser, curl comman line with -N (no buffer) option and with a perl LWP program I wrote. All of them suggest that header(), although is put before do_B() in code, gets executed only after all the php code finished. I add flush() after header() too, but no work. If that is what you are seeing happen, you probably have output buffering turned on The Location: header is acted upon by the BROWSER, not by PHP, not by your server. The BROWSER sees that header and then jumps to somewhere else. My question is: Is there any way that I can return to the client though http response and then continue my progress with my program? You could also look into the pcntl stuff to fork() or, depending on various settings, you might get: exec(do_B() ); to get B to happen in the background. With all that said: As a general rule, when I found myself doing this kind of stuff, I later realized that I hadn't really designed my application very well for an end-user experience. If it takes THAT long to finish B, then you're probably MUCH better off putting something in a ToDo List in your database, and doing B later in a cron job. Then notify the user through email or some kind of status display that they will see on your site frequently when B is done NEVER make the user sit around waiting for your server. Human time is far far far too precious (and expensive!) to waste it sitting around doing nothing useful waiting for your program to finish. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rasmus' 30 second AJAX Tutorial - [was Re: [PHP] AJAX PHP]
On Friday 22 July 2005 02:46, Richard Lynch wrote: If you NEED it to work, JS is simply not the right way to go, even with today's landscape. I think that depends on whether you have a closed environment, such as an intranet, or an open environment like a public web server. In the public case, I'd agree that relying on JS is a bad idea. On a controlled closed environment, there's a good chance that it's an OK idea (and perhaps a good idea). I'm working in a closed environment - I can see some really useful tricks with the JS based 'go check this and come back' method for some of the input fields I need. Will I actually do it? I dunno, I have other things to write first : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MySQL and resouce limits
On Wed, July 20, 2005 5:22 pm, John Hinton said: I don't get it... I have been upping my memory limit for PHP. 32megs now... and am making calls to a database on a different server. I see the loads run up on the other server as it cruches the numbers.. and PHP is in the process of creating a single little page with about 40 numbers on it, from these returns. Now, I do know I'm crunching a LOT of data in this instance, but it seems like MySQL is doing the work and that PHP shouldn't be hitting 32 my 32meg wall. Running the same query on a smaller dataset doesn't hit this limit, so I know it's not a function of the PHP code itself. So, I must be missing something, why is PHP somehow tied to the work MySQL is doing? As in memory usage seems that MySQL should be simply sending PHP the returns on its commands... hm Print out the query you are sending off to MySQL. Inspect it carefully. Use the mysql monitor to run it. Can MySQL, without PHP in the picture, run that query in practical time/memory constraints? How many rows does it actually return? How much data in each row? Dollars to doughnuts sez your query isn't doing what you think it's doing, and it's returning *WAY* more rows than you think, and poor PHP is trying to process them all... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gloabl reference behavior question?
On Wed, July 20, 2005 3:39 pm, Surendra Singhi said: Hello, (1) When I try this code: ?php $var_global = stuff; function f1() { global $var_global; $var_local = array(1,2); $var_global = $var_local; } f1(); print_r($var_global); ? I get the output: stuff where as I was expecting junk value or null. My question is that, because the array is created locally and we pass it by reference (without copying) so on the exit of function, its value is lost, but how does the global variable gets back its old value? Is it something which is not defined by the PHP language reference and is implementation specific? And in this case instead of giving the global variable some junk value or null value, the implementation decides to store the old values? PHP is not C. The operator is not, as far as I know, defined for an array assignment operation. True, you can use in the parameter list in some versions to keep PHP from copying the whole array. But that does not legitimatize what you are doing, I don't think. I could be 100% wrong. I've never even *TRIED* to use a reference to an array because I simply don't want to write code that confusing in the first place. That's why I use PHP to build web pages instead of C. YMMV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] System specific information gathering
Hello, I have a question on how to get Server side system specific information via PHP, or just general direction on how to parse some of the information found in /proc For example, I want to be able to display the system uptime.. number of users logged in, and load average. In the shell, I just do uptime, and it gives me all that information [EMAIL PROTECTED] proc]$ uptime 00:47:42 up 15 days, 7:07, 7 users, load average: 0.44, 0.41, 0.39 Now i can always do a split on , and then based on that parse out the info, or I could cat /proc/uptime and /proc/loadavg For the number of users I can do w -h | wc -l I can call all these commands via the system() function, but my question is, is there a better way of obtaining such info ? http://us2.php.net/manual/en/ref.info.php doesn't seem to offer much, except for the php_uname() function. I just want to be able to display system information like uptime, on some of my web pages. Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php