Re: [PHP] File Manager
2009/2/5 Sn!per sni...@home.net.my: What would you guys recommend as a good and free opensource file management system? TIA. -- Sign Up for free Email at http://ureg.home.net.my/ I haven't use any up to now. But a quick google search turned out decent results: http://phpfm.sourceforge.net/ - for example. Best is if you just look at the search examples yourself and chose a file manager that fits the requirements, that you have. http://www.google.de/search?q=php+file+manager -- Currently developing a browsergame... http://www.p-game.de Trade - Expand - Fight Follow me at twitter! http://twitter.com/moortier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clarity needed
Yannick Mortier wrote: 2009/2/4 tedd t...@sperling.com: Hi gang: I need some fog removed. I have a problem where I have an unlimited number of tutors teaching an unlimited number of courses. When I call upon a tutor, I want to see all the courses they teach. In my old days, I would just set up a linked list of courses and attach it to the tutor (another linked list). As a tutor adds courses, I would just add the course to the end of the linked list. If the tutor deletes a course, then I would remove it from the list by changing a single pointer. If I needed a list of all the courses the tutor taught, I would just run down the linked list pulling them out as needed. But now I have to think in terms of records in a database. I'll eventually figure it out, but what are your suggestions/solutions? I understand that I can have one record set up for each tutor, and another record set up for each course, and then tie the two together by another record like an assignment. That way I can have as many assignments as I want tying courses to tutors. It that the way you guys would do it? Thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com Hi, tedd! Though you might think that this is a stupid task I can recommend you to draw a little entity-relationship model. It quite helps you to overlook the structure of the database that you want to design. It has got different relations between the data and defines a way to represent those in the database. If you are interested in this you can look in wikipedia here: http://en.wikipedia.org/wiki/Entity-relationship_model Since I heard from these models the first time I always use them and I had no more database changes after I started coding since then. Greetings Hey Tedd, Your idea is correct. The keyword you're looking for is 'atomary data', where you have just 1 occurrence of a particular type of information in your entire database. In your case, this translates to: - A single table for tutors (`tutors`) - A single table for courses (`courses`) - A table that combines these two (`tutors_courses`) Basically, what you're doing here is what you did in 'the old days': you're creating a linked list, but on the database level (and more efficient probably; certainly easier to manage). DB queries will cause you some headaches at first, if you're not used to this. You'll be using JOIN instructions to pull data out of the db. I use InnoDB for this type of stuff (it validates the link). Sample query: SELECT `tutors`.`name` AS `tutor_name`, `courses`.`course` AS `course` FROM `tutors_courses` AS `tc` LEFT JOIN `tutors` AS `t` ON `t`.`id` = `tc`.`tutor` LEFT JOIN `courses` AS `c` ON `c`.`id` = `tc`.`course` WHERE whatever you're filter is HTH, Stijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where does the sendmail() function come from?
A while back someone mentioned that I could use the sendmail() function like this: sendmail(envelope-from,envelope-to,mailtext) I'm now in the process of moving a site to a new webserver, and for some reason I haven't got a sendmail() any more. I can't find a reference to it in the manual, so where does it come from? thanks Per -- Per Jessen, Zürich (2.87°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reg-ex help
Craige Leeder schreef: Hey guys, I'm trying to write a regular expression to match a tag for my frameworks template engine. I seem to be having some trouble. The expression should match: {:seg 'segname':} {:seg 'segname' cache:} What I have is... $fSegRegEx = #\{:seg \'[a-z0-9\-\_]{3,}\'( cache)?:\}#i; hth: ?php $fSegRegEx = #(\{:seg )\'([a-z0-9\-\_]{3,})\'((?: cache)?:\})#i; $str = DATA html body h1{:seg 'title':}/h1 h1{:seg 'title' cache:}/h1 /body /html DATA; preg_match_all($fSegRegEx, $str, $faSegMatches, PREG_SET_ORDER); print_r($faSegMatches); ? OUTPUTS: Array ( [0] = Array ( [0] = {:seg 'title':} [1] = {:seg [2] = title [3] = :} ) [1] = Array ( [0] = {:seg 'title' cache:} [1] = {:seg [2] = title [3] = cache:} ) ) Which when run against my test data, seems to match: {:seg 'segname' cache:} cache For arguments sake, I'll provide the whole code snippet... preg_match($fSegRegEx, $this-msOpCont, $faSegMatches); /* faSegMatches == * array * 0 = '{:seg 'users_online' cache:}'// * 1 = ' cache'// */ while ( $fMatch = current($faSegMatches) ) { /* * Expected: * $fMatch[0] = {:seg * $fMatch[1] = Segment Name * * $fMatch[2] = cache:} * or * $fMatch[2] = :} */ $faMatch = explode(', $fMatch); //... //... next($faSegMatches); }// End While Thanks guys. This has been bugging me for a couple days. - Craige -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email configuration
Hi all, I've installed php and mysql in fedora. Now i am able to create php programs. But when I am unable to use email in my programs. I am wondering what is the easiest way to use email in my php programs. Can i send email from my personal computer. I am a regular person connected to internet through an internet provider. Is there any preconfigured software or I have to go through the configuration of sendmail for example? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where does the sendmail() function come from?
Richard Heyes wrote: A while back someone mentioned that I could use the sendmail() function like this: sendmail(envelope-from,envelope-to,mailtext) I'm now in the process of moving a site to a new webserver, and for some reason I haven't got a sendmail() any more. I can't find a reference to it in the manual, so where does it come from? Presumably it's either undocumented or user defined. get_defined_functions() will help you in determining that. Thanks Richard - it was my _own_ function . think I shouldve stayed in bed today. /Per -- Per Jessen, Zürich (5.43°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where does the sendmail() function come from?
Hi, A while back someone mentioned that I could use the sendmail() function like this: sendmail(envelope-from,envelope-to,mailtext) I'm now in the process of moving a site to a new webserver, and for some reason I haven't got a sendmail() any more. I can't find a reference to it in the manual, so where does it come from? Presumably it's either undocumented or user defined. get_defined_functions() will help you in determining that. -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function_exists question
Is there a way to check not only if a function exists, but also to check that the number and types of parameters desired match a function definition? The reason being that additional options have been added in php 4 and 5 to various standard function calls, but I'm still running a php3 and php4 server in addition to a php5 server. I would like to make sure that certain extended function calls still work in all versions (or I'll perform the tasks manually, albeit less efficiently). One example I can think of is the round() function. The $precision parameter was added in php4, so will not work in php3. However, function_exists would return TRUE for both 3 and 4, but round itself would fail if I tried to send a precision level to the php3 server. Thanks much, Matt P.S. Of course the modified function_exists would unfortunately have to be a recognized function/method in php3 in order for me to call it to check parameter counts on a php3 server :( I am sure you have some good reasons for keeping php3 right? Why don't you consider updating to at least php4 ?? PHPv3 is not even maintained and PHPv4 is not being developed any more. So by the end of this year (I hope) we will start using a stable PHPv6. IMHO you should consider changing your code (if this is possible) to a more mainstream version. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is it possible to send POST vars through a header redirect?
I thought the question was pretty straight forward. Sorry about that. As someone mentioned, yes I'm just trying to hide the var from the user. What I meant by I don't want it to stick with the session, is that I don't want it to be available from page to page. I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header(Location: http://domain/?somevar=somevalue;) I'll try some of the previous responses thanks for the help. -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Wednesday, February 04, 2009 12:58 PM To: Mike Roberts Cc: TS; php-general@lists.php.net Subject: RE: [PHP] Is it possible to send POST vars through a header redirect? Just look at the headers of EVERY email that comes from the mailing list, as they contain the unsubscribe email address. On Wed, 2009-02-04 at 09:47 -0500, Mike Roberts wrote: Ladies and Gentlemen. I am a recruiter who joined this list to understand a little about PHP. I respected the boundaries, and never tried to recruit you. Now I am asking for a courtesy in return. I have tried several ways and several times to be excluded from the list, but I still get emails. Can somebody who is 'in charge' please remove me from the list. Thank you. Michael Roberts Senior Recruitment Strategist Corporate Staffing Services 150 Monument Road, Suite 510 Bala Cynwyd, PA 19004 P 610-771-1084 F 610-771-0390 E mrobe...@jobscss.com -Original Message- From: TS [mailto:sunnrun...@gmail.com] Sent: Tuesday, February 03, 2009 5:47 PM To: php-general@lists.php.net Subject: [PHP] Is it possible to send POST vars through a header redirect? I'm trying to send vars via POST somehow. Is this possible? Currently I'm doing header(Location: http://domain/index.php?var=3;); but, want to send POST or some other method that doesn't stick with the session. Thanks, T Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] German characters Ö,Ä etc. show up as ?
Hi there, I recently upgraded on my prod system from php 4.x to the newest php version. Now german characters lik Ö show up as ?. I have the same setup running on a test server, where the characters show up OK. After searching on Google I found that there is an entry in the php.ini: default_charset = iso-8859-1 which could help me, however this is not set in the test environment! How come? Is there another way to fix this? Kind regards,Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email configuration
2009/2/5 It flance itmaqu...@yahoo.com: Hi all, I've installed php and mysql in fedora. Now i am able to create php programs. But when I am unable to use email in my programs. I am wondering what is the easiest way to use email in my php programs. Can i send email from my personal computer. I am a regular person connected to internet through an internet provider. Is there any preconfigured software or I have to go through the configuration of sendmail for example? Thank you Sorry... But I need a _little_ bit more information. What operating system do you use? Linux/Windows/Mac/other? The main problem is that most of the big email providers don't accept mails from dialup connections, but there are solutions to work around this. For now start by telling me which operating system you have. -- Currently developing a browsergame... http://www.p-game.de Trade - Expand - Fight Follow me at twitter! http://twitter.com/moortier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where does the sendmail() function come from?
think I shouldve stayed in bed today. I feel like that most days... -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why does a html mail send as text ?
Hi, The From header shouldn't have in at all, not even escaped as you've done. It should be a valid email address only, and I'm not entirely sure that in email addresses are allowed in most email systems/clients, so it will cause problems. Sure it can. It denotes a quoted string. Like this: Paul Doobla p...@doobla.com -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cgi vs php
[snip] can anybody tell me the benefits of php over cgi or vice versa? i need to compare both? [/snip] CGI is a gateway to be used by languages PHP is a language -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clarity needed
tedd schreef: Hi gang: I need some fog removed. does HARPP have anything for that? what about this? : http://www.postcard.org/fog.mp3 and the answer to you Q, like everyone else said: yup :-) PS - given you unlimited resources you might consider doing a charitable donation to FoxNews aficionados :-) I have a problem where I have an unlimited number of tutors teaching an unlimited number of courses. When I call upon a tutor, I want to see all the courses they teach. In my old days, I would just set up a linked list of courses and attach it to the tutor (another linked list). As a tutor adds courses, I would just add the course to the end of the linked list. If the tutor deletes a course, then I would remove it from the list by changing a single pointer. If I needed a list of all the courses the tutor taught, I would just run down the linked list pulling them out as needed. But now I have to think in terms of records in a database. I'll eventually figure it out, but what are your suggestions/solutions? I understand that I can have one record set up for each tutor, and another record set up for each course, and then tie the two together by another record like an assignment. That way I can have as many assignments as I want tying courses to tutors. It that the way you guys would do it? Thanks, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cgi vs php
Y In cgi i can use perl ,c etc suppose i use perl now how efficiency differs? How cgi written in perl and php is differ in working in context of web service? other difference?. but their differ. On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard jblanch...@pocket.com wrote: [snip] can anybody tell me the benefits of php over cgi or vice versa? i need to compare both? [/snip] CGI is a gateway to be used by languages PHP is a language -- vikas sharma
[PHP] cgi vs php
can anybody tell me the benefits of php over cgi or vice versa? i need to compare both? -- vikas sharma
Re: [PHP] Sometime the code works and sometimes doesn't
Hi, Here is a code for PHP password sending. There is some strange thing happening. This code DOES WORK but not always. So I might be able to get the password in my mailbox once but not always. What could be wrong. ? // database information $host = 'xxx'; $user = 'xxx'; $password = 'xxx'; $dbName = 'xxx'; // connect and select the database $conn = mysql_connect($host, $user, $password) or die(mysql_error()); $db = mysql_select_db($dbName, $conn) or die(mysql_error()); // value sent from form $emailAddress=$_POST['emailAddress']; $sql=SELECT password FROM mytable WHERE emailAddress='$emailAddress'; $result=mysql_query($sql); BTW I think that this vulnerable to SQL injection. So don't put this piece of code in a real as is. Instead escape before making the query with mysql_escape_string: http://www.php.net/manual/en/function.mysql-escape-string.php // keep value in variable name $count $count=mysql_num_rows($result); // compare if $count =1 row if($count==1){ $rows=mysql_fetch_array($result); // keep password in $your_password $your_password=$rows['password']; $subject=Your password is retrieved; $header=from: Great Siteno-re...@somesite.com; $messages= Hi \n\n Your password for login to our website is retrieved.\n\n; $messages.=Your password is '$your_password' \n\n; $messages.=You can use this password; // send email $sentmail = mail($emailAddress, $subject, $messages, $header); } // else if $count not equal 1 else { echo Not found your email in our database; } // if your email succesfully sent if($sentmail){ echo Your Password Has Been Sent To Your Email Address.; } else { echo Cannot send password to your e-mail address; } ? There must be something that I am doing wrong. Otherwise I could have always gotten the password in my mailbox. Please help. Thanks in advance, Chris -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email configuration
2009/2/5 It flance itmaqu...@yahoo.com: Hi all, I've installed php and mysql in fedora. Now i am able to create php programs. But when I am unable to use email in my programs. I am wondering what is the easiest way to use email in my php programs. Can i send email from my personal computer. I am a regular person connected to internet through an internet provider. Is there any preconfigured software or I have to go through the configuration of sendmail for example? Thank you Sorry... But I need a _little_ bit more information. What operating system do you use? Linux/Windows/Mac/other? The main problem is that most of the big email providers don't accept mails from dialup connections, but there are solutions to work around this. For now start by telling me which operating system you have. I think that the OP mentioned the word fedora somewhere above... To the point: Your linux probably has already installed the sendmail suite. If that is the case (run rpm -qa | grep sendmail to check) you may safely use the PHP's mail function for simple things. In case you don't have sendmail installed use: # yum install sendmail http://www.php.net/manual/en/function.mail.php If you need more advanced features like for e.g. adding attachments to your e-mails you may consider other options like phpmailer. I have never used it myself but many people that belong in this gang are very fond of it. http://phpmailer.codeworxtech.com/ Keep in mind that in case you have compiled PHP from source without having the sendmail installed you may need to recompile it. You can find this by making a phpinfo somewhere. In case you have installed from package no harm is done. Put this in a script: ?php phpinfo(); ? You will find sendmail_path somethere in the resulting page or something like that Path to sendmail. If this is set then everything will work like a charm. -- Thodoris
RE: [PHP] Is it possible to send POST vars through a header redirect?
At 2:52 AM -0700 2/5/09, TS wrote: I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header(Location: http://domain/?somevar=somevalue;) That would, by definition, allow the user to see it. If you want to pass a variable to another script, I know of four choices, namely: 1. Use POST; 2. Use GET; 3. Write the variable to a database; 4. Include the next script. HTH's tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cgi vs php
Y In cgi i can use perl ,c etc suppose i use perl now how efficiency differs? How cgi written in perl and php is differ in working in context of web service? other difference?. but their differ. On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard jblanch...@pocket.com wrote: [snip] can anybody tell me the benefits of php over cgi or vice versa? i need to compare both? [/snip] CGI is a gateway to be used by languages PHP is a language First of all try not to top post this is what we usually do here. Well CGI is a standard protocol implemented by many programming languages. You may start googling to find about it but this is a start: http://en.wikipedia.org/wiki/Common_Gateway_Interface Both Perl and PHP can work with CGI but working with Perl-CGI is not something that we should discuss in this list since this is a *PHP* list. IMHO you should start reading some aspects of web development to make some things clear before start asking questions in the lsit. This will improve your understanding and it help us to make suggestions. -- Thodoris
Re: [PHP] Blank page of hell..what to look for
Is there a certain thing that should be suspected and looked at first when getting the php blank page of hell I have errors on and nothing is being output anywhere to lead me in the right direction, I have a VariableReveal script (one of you provide and THANK YOU IT HAS BEEN A LIFESAVER) But it is doing nothing today, yesterday the page worked today I get the blank page with not a clue in sight ARGH... Terion First of all check if you are displaying error in your php.ini display_errors = On but don't use this in a normal site. You are probably already doing this because you mentioned that errors get displayed. You may use die to verify the how variables are changing values through the script and see if everything they store is what you want. die(print $var); die(print_r($array); die(var_dump($var)); You use it as you need to track down what is messing your script. Another way I can think you may use is exceptions especially if you are a PHP5 user. This could be useful: http://www.php.net/manual/en/language.exceptions.php I suspect that you would get a better answer if you were willing to send us some more details in what you are trying to do. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Blank page of hell..what to look for
On Mon, Feb 2, 2009 at 12:51 PM, Jim Lucas li...@cmsws.com wrote: Terion Miller wrote: Is there a certain thing that should be suspected and looked at first when getting the php blank page of hell I have errors on and nothing is being output anywhere to lead me in the right direction, I have a VariableReveal script (one of you provide and THANK YOU IT HAS BEEN A LIFESAVER) But it is doing nothing today, yesterday the page worked today I get the blank page with not a clue in sight ARGH... Terion More then likely it is a parse error within the page. And no matter what error reporting you have turned on within the script will effect the outcome. You have two choices. Turn on error reporting from apache using the httpd.conf file, in your php.ini file, or with a .htaccess file. This is the only way to get around parse errors without having error reporting turned on globally. The other way is to cut/paste your code into sections. Cut out a large chunk of it, see if it works, if it does, paste it back in and remove a smaller chunk, rinse/repeat until your find the error of your ways... :) Better yet, use a IDE the does code highlighting. This would point you to the problem rather quickly. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yes I have not had a single parse error in any of my files since I started using Eclipse (first phpeclipse but now PDT). It will even scan every single file in your current site (project) to make sure there's nothing wrong in them. It then puts a red icon inside the file explorer and also adds an entry into the problems tab. Very useful stuff. It also has real-time parse error detection to help you from making them in the first place. -- http://www.voom.me | EFnet: #voom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] kadm5 Library
Sorry, I could have been a little clearer: I can't recompile PHP. It's against our general policy to use custom compiled software on the grounds that there are too many sysadmins managing a lot of these machines and if some software is custom compiled and others not, it gets too confusing when it comes to keeping the machines updated and patched. We're talking a dozen sysadmins and hundreds of machines here. :) That is understandable. No harm is done and sorry for the late reply. I did try to compile the PECL library by specifying the path to the Kerberos libraries as you suggested, but it turns out that the normal version of Kerberos seems to have, among other things, a krb5/admin.h header file, and the one that comes with CentOS has krb5/krb5.h instead, and even when I change the source code to use krb5/krb5.h, it still throws about 50 errors talking about missing functions and re-defined functions and so on. Did you try to install krb5-devel. Try yum search krb5 to see all the available packages that CentOS includes. In case your yum doesn't find something you may add more repos like Dag's: http://dag.wieers.com/ It is just an rpm that updates the systems repositories that I find very useful. I'm thinking that the problem is that the PECL module was designed to work with one version of the Kerberos library and CentOS provides a different version. I guess I was really asking if anyone had any diffs or anything I could apply to the PECL module to make it compile on a CentOS machine. Or perhaps is there a Yum repository somewhere that I could use to get a version of the PECL module precompiled for CentOS? I am not aware if there is a pre-compiled package for kerberos but Dag's repo doesn't provide it AFAIK. It does provide some other pecl extensions like php-pecl-fileinfo etc but not this one. What you need is to find a kerberos rpm to include development header in order to compile it your self. I should point out that the Perl Kerberos module did install and compile successfully on this machine, so I'm fairly sure that Kerberos is itself working. Tim Gustafson BSOE Webmaster UC Santa Cruz t...@soe.ucsc.edu 831-459-5354 Well let me tell what I did: I have installed this that is needed for the package to work: http://dag.wieers.com/rpm/packages/re2c/re2c-0.12.0-1.el5.rf.i386.rpm I have downloaded the source and tried to compile it with: ./configure --with-kadm5=/usr/include/krb5 But the compilation failed. My installed packages are: krb5-server-1.6.1-25.el5_2.2 krb5-libs-1.6.1-25.el5_2.2 krb5-workstation-1.6.1-25.el5_2.2 pam_krb5-2.2.14-1.el5_2.1 krb5-devel-1.6.1-25.el5_2.2 And then I run into this: http://pecl.php.net/bugs/bug.php?id=15196thanks=3 I have already reported the bug and lets hope it will get fixed. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email configuration
2009/2/5 Thodoris t...@kinetix.gr: I think that the OP mentioned the word fedora somewhere above... Oh sorry, I'm so stupid... Anyways, if you want to send mail to large providers you'll need to use a relay. I found a nice tutorial about how to set it up with google apps. It was for Ubuntu but you just have to install msmtp and follow the other steps. Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail I did it on my little gentoo server here at home and it works great. -- Currently developing a browsergame... http://www.p-game.de Trade - Expand - Fight Follow me at twitter! http://twitter.com/moortier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cgi vs php
Thodoris napsal(a): Y In cgi i can use perl ,c etc suppose i use perl now how efficiency differs? How cgi written in perl and php is differ in working in context of web service? other difference?. but their differ. On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard jblanch...@pocket.com wrote: [snip] can anybody tell me the benefits of php over cgi or vice versa? i need to compare both? [/snip] CGI is a gateway to be used by languages PHP is a language First of all try not to top post this is what we usually do here. Well CGI is a standard protocol implemented by many programming languages. You may start googling to find about it but this is a start: http://en.wikipedia.org/wiki/Common_Gateway_Interface Both Perl and PHP can work with CGI but working with Perl-CGI is not something that we should discuss in this list since this is a *PHP* list. IMHO you should start reading some aspects of web development to make some things clear before start asking questions in the lsit. This will improve your understanding and it help us to make suggestions. I admire your calmness. Such a descriptive reply for someone who doesn't think before asking. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Garbage Collection
Hi gang: A related question to my last Clarity needed post. I have a tutor table (showing all the tutors), a course table (showing all the courses), and a course-to-tutor table (showing all the instances of what tutor teaches what course). Okay, everything works. Whenever I want to find out what courses a specific tutor teaches OR what tutors teach a specific course, I simply search the course-to-tutor table and bingo out pops the answer. Now, how do you handle the situation when a tutor quits or when a course is no longer offered? If I search the course-to-tutor table for all the tutors who teach a course and find a tutor who is no longer there OR search the course-to-tutor table for all the courses a tutor teaches and find a course that is no longer offered, how do you handle the record? I realize that if either search turns up nothing, I can check for that situation and then handle it accordingly. But my question is more specifically, in the event of a tutor quilting OR removing a course from the curriculum, what do you do about the course-to-tutor orphaned record? As I see it, my choices are to a) ignore the orphaned record or b) delete the orphaned record. If I ignore the record, then the database grows with orphaned records and searches are slowed. If I delete the orphaned record, then the problem is solved, right? I just want to get a consensus of how you people normally handle it. Do any of you see in danger in deleting an orphaned record? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Garbage Collection
On Thu, Feb 5, 2009 at 11:06 AM, tedd t...@sperling.com wrote: Hi gang: A related question to my last Clarity needed post. I have a tutor table (showing all the tutors), a course table (showing all the courses), and a course-to-tutor table (showing all the instances of what tutor teaches what course). Okay, everything works. Whenever I want to find out what courses a specific tutor teaches OR what tutors teach a specific course, I simply search the course-to-tutor table and bingo out pops the answer. Now, how do you handle the situation when a tutor quits or when a course is no longer offered? If I search the course-to-tutor table for all the tutors who teach a course and find a tutor who is no longer there OR search the course-to-tutor table for all the courses a tutor teaches and find a course that is no longer offered, how do you handle the record? I realize that if either search turns up nothing, I can check for that situation and then handle it accordingly. But my question is more specifically, in the event of a tutor quilting OR removing a course from the curriculum, what do you do about the course-to-tutor orphaned record? As I see it, my choices are to a) ignore the orphaned record or b) delete the orphaned record. If I ignore the record, then the database grows with orphaned records and searches are slowed. If I delete the orphaned record, then the problem is solved, right? I just want to get a consensus of how you people normally handle it. Do any of you see in danger in deleting an orphaned record? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Could add a status flag to the records to indicate if they're active or not. Or you could use InnoDB and have it cascade delete join records. Status is nice though in case they come back or to provide an undelete type functionality. -- http://www.voom.me | EFnet: #voom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Garbage Collection
-Original Message- From: tedd [mailto:t...@sperling.com] Sent: Thursday, February 05, 2009 10:07 AM To: php-general@lists.php.net Subject: [PHP] Garbage Collection Hi gang: A related question to my last Clarity needed post. I have a tutor table (showing all the tutors), a course table (showing all the courses), and a course-to-tutor table (showing all the instances of what tutor teaches what course). Okay, everything works. Whenever I want to find out what courses a specific tutor teaches OR what tutors teach a specific course, I simply search the course-to-tutor table and bingo out pops the answer. Now, how do you handle the situation when a tutor quits or when a course is no longer offered? If I search the course-to-tutor table for all the tutors who teach a course and find a tutor who is no longer there OR search the course-to-tutor table for all the courses a tutor teaches and find a course that is no longer offered, how do you handle the record? I realize that if either search turns up nothing, I can check for that situation and then handle it accordingly. But my question is more specifically, in the event of a tutor quilting OR removing a course from the curriculum, what do you do about the course-to-tutor orphaned record? As I see it, my choices are to a) ignore the orphaned record or b) delete the orphaned record. If I ignore the record, then the database grows with orphaned records and searches are slowed. If I delete the orphaned record, then the problem is solved, right? I just want to get a consensus of how you people normally handle it. Do any of you see in danger in deleting an orphaned record? tedd, I believe relational integrity can solve your problem. In MySQL (and maybe MSSQL, but I am less versed with that product) you should be able to put a CASCADE option on the DELETE action for your tutor table so that when a record is deleted, its associated record in tutors-to-courses is also deleted. I'm assuming you would want to do the same for removing a record in tutors-to-courses when a course is removed (but not remove the tutor, the same as you do not remove the course itself when the tutor is deleted). I suppose you could also do it yourself with PHP code when a failed link is turned up, but why bother separating DB logic from the DB itself? :) HTH, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Garbage Collection
Hi gang: A related question to my last Clarity needed post. I have a tutor table (showing all the tutors), a course table (showing all the courses), and a course-to-tutor table (showing all the instances of what tutor teaches what course). Okay, everything works. Whenever I want to find out what courses a specific tutor teaches OR what tutors teach a specific course, I simply search the course-to-tutor table and bingo out pops the answer. Now, how do you handle the situation when a tutor quits or when a course is no longer offered? If I search the course-to-tutor table for all the tutors who teach a course and find a tutor who is no longer there OR search the course-to-tutor table for all the courses a tutor teaches and find a course that is no longer offered, how do you handle the record? I realize that if either search turns up nothing, I can check for that situation and then handle it accordingly. But my question is more specifically, in the event of a tutor quilting OR removing a course from the curriculum, what do you do about the course-to-tutor orphaned record? As I see it, my choices are to a) ignore the orphaned record or b) delete the orphaned record. If I ignore the record, then the database grows with orphaned records and searches are slowed. If I delete the orphaned record, then the problem is solved, right? I just want to get a consensus of how you people normally handle it. Do any of you see in danger in deleting an orphaned record? Cheers, tedd I guess that all depends. If you want some kind of historical log of what tutor taught which course and which courses have previously been offered then I wouldn't delete the records. Instead I would and something like a Active column and use simple Y and N vaules to mark each tutor or course as active and then just re-write your query to only pull tutor's/courses with the Y flag. That would give you a current listing of active courses and who teaches them, and also retain the historical data if it need to be referenced later. If you don't care about historical data, you could just do a DELETE FROM my_table where course/tutor id = x But I would recreate an index on the table after deletion of records to keep the speed crisp. Dan
Re: [PHP] kadm5 Library
Did you try to install krb5-devel. Try yum search krb5 to see all the available packages that CentOS includes. In case your yum doesn't find something you may add more repos like Dag's: I did. The krb5-devel package is the one that installed krb5/krb5.h, but as I mentioned that seems to be a different version than the one that the PECL library expects. I've used Dag's repository before, but as you pointed out, it doesn't contain this package. What you need is to find a kerberos rpm to include development header in order to compile it your self. I thought about grabbing the header from another OS, but I'm concerned about incompatibilities. For now, I'm just using the expect library and running kadmin.local via sudo as needed. It's clunky, but it's working. :) Thanks for all your help! Tim Gustafson BSOE Webmaster UC Santa Cruz t...@soe.ucsc.edu 831-459-5354 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Garbage Collection
On Thu, Feb 5, 2009 at 11:10 AM, Eric Butera eric.but...@gmail.com wrote: On Thu, Feb 5, 2009 at 11:06 AM, tedd t...@sperling.com wrote: Hi gang: A related question to my last Clarity needed post. I have a tutor table (showing all the tutors), a course table (showing all the courses), and a course-to-tutor table (showing all the instances of what tutor teaches what course). Okay, everything works. Whenever I want to find out what courses a specific tutor teaches OR what tutors teach a specific course, I simply search the course-to-tutor table and bingo out pops the answer. Now, how do you handle the situation when a tutor quits or when a course is no longer offered? If I search the course-to-tutor table for all the tutors who teach a course and find a tutor who is no longer there OR search the course-to-tutor table for all the courses a tutor teaches and find a course that is no longer offered, how do you handle the record? I realize that if either search turns up nothing, I can check for that situation and then handle it accordingly. But my question is more specifically, in the event of a tutor quilting OR removing a course from the curriculum, what do you do about the course-to-tutor orphaned record? As I see it, my choices are to a) ignore the orphaned record or b) delete the orphaned record. If I ignore the record, then the database grows with orphaned records and searches are slowed. If I delete the orphaned record, then the problem is solved, right? I just want to get a consensus of how you people normally handle it. Do any of you see in danger in deleting an orphaned record? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Could add a status flag to the records to indicate if they're active or not. Or you could use InnoDB and have it cascade delete join records. Status is nice though in case they come back or to provide an undelete type functionality. -- http://www.voom.me | EFnet: #voom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php this gets my vote -- Bastien Cat, the other other white meat
Re: [PHP] Blank page of hell..what to look for
Better yet, use a IDE the does code highlighting. This would point you to the problem rather quickly. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare Speaking of IDE, which do people on here prefer, I have been using Dreamweaver CS3 just because as originally a designer I was/am used to it... I did finally find the problem but moving an echo(damnit); from line to line commenting out everything below it...Oi ...is this ever going to get easier for me I often wonder...
Re: [PHP] Re: More questions about SESSION use
On Mon, Feb 2, 2009 at 4:18 PM, Chris dmag...@gmail.com wrote: Edmund Hertle wrote: 2009/2/1 Terion Miller webdev.ter...@gmail.com This is how it was originally written: if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] != true){ header (Location: LogOut.php); $_SESSION['user']=$UserName; $_SESSION['AdminID']=$AdminID; --*I added this one originally the script only used 'user' and 'AdminLogin'* but passed them in urls } Those two lines after header() will not be executed. Yes they will because there is no 'exit'. Header is just a function call, if you want to stop processing you have to do it yourself. -- Postgresql php tutorials http://www.designmagick.com/ Is it better to use the session_register() could that be my issue ,although my sessions are passing from page to page so they are registered? right... is this part of that loose format that php coders just love and I hate..because it to me makes learning it hard... t.
Re: [PHP] Blank page of hell..what to look for
On Thu, Feb 05, 2009 at 11:11:03AM -0600, Terion Miller wrote: Speaking of IDE, which do people on here prefer, I have been using Dreamweaver CS3 just because as originally a designer I was/am used to it... I did finally find the problem but moving an echo(damnit); from line to line commenting out everything below it...Oi ...is this ever going to get easier for me I often wonder... Use Vim. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clarity needed
On Thu, Feb 5, 2009 at 07:56, Jochem Maas joc...@iamjochem.com wrote: and the answer to you Q, like everyone else said: yup :-) PS - given you unlimited resources you might consider doing a charitable donation to FoxNews aficionados :-) Or reminding you how to speak English, Jochem. What the hell are you trying to say here?!? ;-P Man, a guy disappears for a while and his speech goes to gibberish almost as bad as my own. ;-P -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Garbage Collection
Dan Shirah wrote: Hi gang: A related question to my last Clarity needed post. I have a tutor table (showing all the tutors), a course table (showing all the courses), and a course-to-tutor table (showing all the instances of what tutor teaches what course). Okay, everything works. Whenever I want to find out what courses a specific tutor teaches OR what tutors teach a specific course, I simply search the course-to-tutor table and bingo out pops the answer. Now, how do you handle the situation when a tutor quits or when a course is no longer offered? If I search the course-to-tutor table for all the tutors who teach a course and find a tutor who is no longer there OR search the course-to-tutor table for all the courses a tutor teaches and find a course that is no longer offered, how do you handle the record? I realize that if either search turns up nothing, I can check for that situation and then handle it accordingly. But my question is more specifically, in the event of a tutor quilting OR removing a course from the curriculum, what do you do about the course-to-tutor orphaned record? As I see it, my choices are to a) ignore the orphaned record or b) delete the orphaned record. If I ignore the record, then the database grows with orphaned records and searches are slowed. If I delete the orphaned record, then the problem is solved, right? I just want to get a consensus of how you people normally handle it. Do any of you see in danger in deleting an orphaned record? Cheers, tedd I guess that all depends. If you want some kind of historical log of what tutor taught which course and which courses have previously been offered then I wouldn't delete the records. Instead I would and something like a Active column and use simple Y and N vaules to mark each tutor or course as active and then just re-write your query to only pull tutor's/courses with the Y flag. That would give you a current listing of active courses and who teaches them, and also retain the historical data if it need to be referenced later. IMHO forget the active flag, replace it with a field deleted which is a timestamp, then you've got an audit trail of when the it was removed :) infact often seen three fields on every table, inserted, updated and deleted all timestamps and self explanatory. regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a headerredirect?
tedd wrote: At 2:52 AM -0700 2/5/09, TS wrote: I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header(Location: http://domain/?somevar=somevalue;) That would, by definition, allow the user to see it. If you want to pass a variable to another script, I know of four choices, namely: 1. Use POST; 2. Use GET; 3. Write the variable to a database; 4. Include the next script. HTH's tedd 5. Stick it in the session -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to send POST vars through a headerredirect?
At 1:18 PM -0600 2/5/09, Shawn McKenzie wrote: tedd wrote: At 2:52 AM -0700 2/5/09, TS wrote: I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header(Location: http://domain/?somevar=somevalue;) That would, by definition, allow the user to see it. If you want to pass a variable to another script, I know of four choices, namely: 1. Use POST; 2. Use GET; 3. Write the variable to a database; 4. Include the next script. HTH's tedd 5. Stick it in the session -- Thanks! -Shawn Duh! Thanks, I should wait a day before posting anything. tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connect local app to a web app
Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] German characters Ö,Ä etc. show up as ?
On Thu, 2009-02-05 at 13:37 +0100, Merlin Morgenstern wrote: Hi there, I recently upgraded on my prod system from php 4.x to the newest php version. Now german characters lik Ö show up as ?. I have the same setup running on a test server, where the characters show up OK. After searching on Google I found that there is an entry in the php.ini: default_charset = iso-8859-1 which could help me, however this is not set in the test environment! How come? Is there another way to fix this? Kind regards,Merlin Can you not add it to the php.ini in the live environment? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Blank page of hell..what to look for
On Thu, 2009-02-05 at 12:22 -0500, Paul M Foster wrote: On Thu, Feb 05, 2009 at 11:11:03AM -0600, Terion Miller wrote: Speaking of IDE, which do people on here prefer, I have been using Dreamweaver CS3 just because as originally a designer I was/am used to it... I did finally find the problem but moving an echo(damnit); from line to line commenting out everything below it...Oi ...is this ever going to get easier for me I often wonder... Use Vim. ;-} Paul -- Paul M. Foster Any editor with coloured syntax highlighting will help. Just scanning through the script visually should let you spot the obvious errors, and then breaking the script down into chunks with echo statements is the next step. You don't need to break it down line by line, that takes ages! Instead, put one halfway through your code, that will let you know if the error is in the top or bottom half, then just keep breaking it down half at a time and soon you'll have the part the error is in. It's just a typical trial-and-error algorithm. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Garbage Collection
At 7:03 PM + 2/5/09, Nathan Rixham wrote: IMHO forget the active flag, replace it with a field deleted which is a timestamp, then you've got an audit trail of when the it was removed :) infact often seen three fields on every table, inserted, updated and deleted all timestamps and self explanatory. Nathan: As usual, you (and others on this list) have clarity on this. I think I'll go your route except I'll have a date created and date inactive field but not a date updated field. In this situation there would never be a reason for an update. After all, the tutor_course record is created when an assignment is made -- when the assignment is broken, then the record becomes inactive. So, there's no reason to update. Do, or don't do, there is no try. -- Yoda Thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: More questions about SESSION use
On Thu, Feb 5, 2009 at 9:16 AM, Terion Miller webdev.ter...@gmail.comwrote: On Mon, Feb 2, 2009 at 4:18 PM, Chris dmag...@gmail.com wrote: Edmund Hertle wrote: 2009/2/1 Terion Miller webdev.ter...@gmail.com This is how it was originally written: if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] != true){ header (Location: LogOut.php); $_SESSION['user']=$UserName; $_SESSION['AdminID']=$AdminID; --*I added this one originally the script only used 'user' and 'AdminLogin'* but passed them in urls } Those two lines after header() will not be executed. Yes they will because there is no 'exit'. Header is just a function call, if you want to stop processing you have to do it yourself. -- Postgresql php tutorials http://www.designmagick.com/ Is it better to use the session_register() could that be my issue ,although my sessions are passing from page to page so they are registered? right... is this part of that loose format that php coders just love and I hate..because it to me makes learning it hard... t. FYI session_register is deprecated in PHP 5.3.0 and completely going away in PHP 6.0. Please don't use it. Thanks, V
Re: [PHP] Re: More questions about SESSION use
On Thu, 2009-02-05 at 11:16 -0600, Terion Miller wrote: On Mon, Feb 2, 2009 at 4:18 PM, Chris dmag...@gmail.com wrote: Edmund Hertle wrote: 2009/2/1 Terion Miller webdev.ter...@gmail.com This is how it was originally written: if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] != true){ header (Location: LogOut.php); $_SESSION['user']=$UserName; $_SESSION['AdminID']=$AdminID; --*I added this one originally the script only used 'user' and 'AdminLogin'* but passed them in urls } Those two lines after header() will not be executed. Yes they will because there is no 'exit'. Header is just a function call, if you want to stop processing you have to do it yourself. -- Postgresql php tutorials http://www.designmagick.com/ Is it better to use the session_register() could that be my issue ,although my sessions are passing from page to page so they are registered? right... is this part of that loose format that php coders just love and I hate..because it to me makes learning it hard... t. Just use a session_start() before any output to the server, and the sessions array will be available to your code. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Blank page of hell..what to look for
Maybe X-Debug (http://www.xdebug.org/) could help you find bugs in your code, and for development environments it's recommended to use the most sensitive level of messages (turn on E_STRICT and E_NOTIVE, for example). 2009/2/5 Ashley Sheridan a...@ashleysheridan.co.uk On Thu, 2009-02-05 at 12:22 -0500, Paul M Foster wrote: On Thu, Feb 05, 2009 at 11:11:03AM -0600, Terion Miller wrote: Speaking of IDE, which do people on here prefer, I have been using Dreamweaver CS3 just because as originally a designer I was/am used to it... I did finally find the problem but moving an echo(damnit); from line to line commenting out everything below it...Oi ...is this ever going to get easier for me I often wonder... Use Vim. ;-} Paul -- Paul M. Foster Any editor with coloured syntax highlighting will help. Just scanning through the script visually should let you spot the obvious errors, and then breaking the script down into chunks with echo statements is the next step. You don't need to break it down line by line, that takes ages! Instead, put one halfway through your code, that will let you know if the error is in the top or bottom half, then just keep breaking it down half at a time and soon you'll have the part the error is in. It's just a typical trial-and-error algorithm. Ash www.ashleysheridan.co.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] Garbage Collection
On Thu, Feb 05, 2009 at 02:48:14PM -0500, tedd wrote: At 7:03 PM + 2/5/09, Nathan Rixham wrote: IMHO forget the active flag, replace it with a field deleted which is a timestamp, then you've got an audit trail of when the it was removed :) infact often seen three fields on every table, inserted, updated and deleted all timestamps and self explanatory. Nathan: As usual, you (and others on this list) have clarity on this. I think I'll go your route except I'll have a date created and date inactive field but not a date updated field. In this situation there would never be a reason for an update. After all, the tutor_course record is created when an assignment is made -- when the assignment is broken, then the record becomes inactive. So, there's no reason to update. Do, or don't do, there is no try. -- Yoda Actually, if I needed a history, I wouldn't do it with timestamp fields in the table. I'd build a new file that contained the history. Maybe when timestamp operation char(1) what char(1) which id Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connect local app to a web app
Jônatas Zechim wrote: Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. Mysql replication... :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connect local app to a web app
On Thu, Feb 05, 2009 at 05:24:45PM -0200, Jônatas Zechim wrote: Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. If you have control of the server, you can just set this up in a bash script, using mysql commands, which connect to the remote and then then local databases. I'm talking about cron running the script periodically. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Connect local app to a web app
hi... can you describe in psuedocode what you're trying to accomplish? might be able to help if i have a better understanding of where you're trying to go. -Original Message- From: Jônatas Zechim [mailto:zechim@gmail.com] Sent: Thursday, February 05, 2009 11:25 AM To: php-general@lists.php.net Subject: [PHP] Connect local app to a web app Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. -- 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] Connect local app to a web app
2009/2/5 Paul M Foster pa...@quillandmouse.com On Thu, Feb 05, 2009 at 05:24:45PM -0200, Jônatas Zechim wrote: Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. If you have control of the server, you can just set this up in a bash script, using mysql commands, which connect to the remote and then then local databases. I'm talking about cron running the script periodically. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can set up a web service using XML-RPC or JSON-RPC , you don't necessarily need a db -- Alpar Torok
Re: [PHP] Connect local app to a web app
2009/2/5 Alpár Török torokal...@gmail.com 2009/2/5 Paul M Foster pa...@quillandmouse.com On Thu, Feb 05, 2009 at 05:24:45PM -0200, Jônatas Zechim wrote: Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. If you have control of the server, you can just set this up in a bash script, using mysql commands, which connect to the remote and then then local databases. I'm talking about cron running the script periodically. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can set up a web service using XML-RPC or JSON-RPC , you don't necessarily need a db PS: I meant you don't need the db locally -- Alpar Torok -- Alpar Torok
Re: [PHP] Connect local app to a web app
Alpár Török wrote: 2009/2/5 Alpár Török torokal...@gmail.com 2009/2/5 Paul M Foster pa...@quillandmouse.com On Thu, Feb 05, 2009 at 05:24:45PM -0200, Jônatas Zechim wrote: Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. If you have control of the server, you can just set this up in a bash script, using mysql commands, which connect to the remote and then then local databases. I'm talking about cron running the script periodically. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can set up a web service using XML-RPC or JSON-RPC , you don't necessarily need a db PS: I meant you don't need the db locally except for the fact that the op said he wanted to *save* it to a *localhost database*. -- Alpar Torok -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Connect local app to a web app
Ok, i have a app running on a website writen in php that insert data into a database(web) every 3s all day long, and I need to get this data(every 3s too) and save into local database, both are mysql database, but I don't know the best way to do it, with socks, XML, XML-RPC. Thanks Zechim. -Mensagem original- De: Jim Lucas [mailto:li...@cmsws.com] Enviada em: quinta-feira, 5 de fevereiro de 2009 18:13 Para: Alpár Török Cc: Paul M Foster; php-general@lists.php.net Assunto: Re: [PHP] Connect local app to a web app Alpár Török wrote: 2009/2/5 Alpár Török torokal...@gmail.com 2009/2/5 Paul M Foster pa...@quillandmouse.com On Thu, Feb 05, 2009 at 05:24:45PM -0200, Jônatas Zechim wrote: Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. If you have control of the server, you can just set this up in a bash script, using mysql commands, which connect to the remote and then then local databases. I'm talking about cron running the script periodically. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can set up a web service using XML-RPC or JSON-RPC , you don't necessarily need a db PS: I meant you don't need the db locally except for the fact that the op said he wanted to *save* it to a *localhost database*. -- Alpar Torok -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- 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] Is it possible to send POST vars through aheaderredirect?
tedd wrote: At 1:18 PM -0600 2/5/09, Shawn McKenzie wrote: tedd wrote: At 2:52 AM -0700 2/5/09, TS wrote: I want my script to run and redirect with the var to another page without the user seeing it. Currently, I am using GET and header(Location: http://domain/?somevar=somevalue;) That would, by definition, allow the user to see it. If you want to pass a variable to another script, I know of four choices, namely: 1. Use POST; 2. Use GET; 3. Write the variable to a database; 4. Include the next script. HTH's tedd 5. Stick it in the session -- Thanks! -Shawn Duh! Thanks, I should wait a day before posting anything. tedd Only a day? Sometimes I click send before I'm even finished ty -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: More questions about SESSION use
Just use a session_start() before any output to the server, and the sessions array will be available to your code. Ash www.ashleysheridan.co.uk Ah ha...and now I know why my O'reilly book Web Database Applications with PHP was so inexpensive... :) it's outdated...oops...
Re: RES: [PHP] Connect local app to a web app
Jônatas Zechim wrote: Ok, i have a app running on a website writen in php that insert data into a database(web) every 3s all day long, and I need to get this data(every 3s too) and save into local database, both are mysql database, but I don't know the best way to do it, with socks, XML, XML-RPC. Thanks Zechim. -Mensagem original- De: Jim Lucas [mailto:li...@cmsws.com] Enviada em: quinta-feira, 5 de fevereiro de 2009 18:13 Para: Alpár Török Cc: Paul M Foster; php-general@lists.php.net Assunto: Re: [PHP] Connect local app to a web app Alpár Török wrote: 2009/2/5 Alpár Török torokal...@gmail.com 2009/2/5 Paul M Foster pa...@quillandmouse.com On Thu, Feb 05, 2009 at 05:24:45PM -0200, Jônatas Zechim wrote: Hi there, i'm here again, but now with another doubt. What's the best way to connect a local app write in php or php-gtk to a web app writen in php. The database is MySql, and i need to do this connection every 3s to check data, get the data back and save into localhost database. If you have control of the server, you can just set this up in a bash script, using mysql commands, which connect to the remote and then then local databases. I'm talking about cron running the script periodically. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can set up a web service using XML-RPC or JSON-RPC , you don't necessarily need a db PS: I meant you don't need the db locally except for the fact that the op said he wanted to *save* it to a *localhost database*. -- Alpar Torok Personally, I would look at mysql replication running locally on your mysql database. It is handled completely by mysql. No need to use other applications or languages to reproduce the replication ability already designed into mysql. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DB Comparisons
Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09]
[PHP] Re: DB Comparisons
revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. honestly, if you're thinking enterprise scale then database is the least of you're worries, you'll be needing to move away from a scripting language and go for a pre compiled programming language. if you must script this then mysql cluster is probably you're best route to gain what you need, any of the others and you're (probably) going to run into transactional problems especially with multi-master replication. Primarily though one would imagine you'll be doing more reads than writes, in which case you'll be needing a lot of caching in there, second level not just the sql query cache. Using PHP and suchlike is possible for an enterprise ap, but only if you bolt on massive amounts of caching at both the data side and the presentation side of your app. Back to specifics, how the back end database will bear up in an enterprise situation (you'll like this) assuming that all your tables are properly created and optimised assuming you've indexed everything perfectly after analysing every sql query assuming you've optimised every sql query perfectly and you're database is normalised and optimised for you're application structure assuming you've configured all the database server variables correctly for the application and to make the most of the hardware assuming the physical server is of a decent specification and not an old pentium 3 with 128mb ram assuming you're application is well optimised and with no caches then: you'll find 1 database server will support approx 2 UI (user interface) servers of a similar running at full tilt - but you've got a single point of failure by only having one db server so you'll need to look at that :p all in all, with a web app that's scripted you need not worry about which database server to use, pick one from preference and to budget and roll with it. IMHO go php mysql, tonnes of reference online, loads of help, cheaper than going m$sql with windows hosting, and easier to dive in to and use well than postgres. ps: when you've covered all those assuming(s) above come back and we'll give you a better idea of where to go next based on the info you give us. Regards :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Bad words [SQL, database, txt, whatever]
Ashley Sheridan wrote: On Wed, 2009-02-04 at 18:34 -0200, Jônatas Zechim wrote: Thank you, but i thought one of you had the .sql or .txt, .xls, etc. I had already find that results. But it's ok now.. zechim -Mensagem original- De: Andrew Ballard [mailto:aball...@gmail.com] Enviada em: quarta-feira, 4 de fevereiro de 2009 18:19 Para: Jônatas Zechim Cc: PHP-General List Assunto: Re: [PHP] Bad words [SQL, database, txt, whatever] On Wed, Feb 4, 2009 at 2:48 PM, Jônatas Zechim zechim@gmail.com wrote: Hi there I don't know how to say 'palavrões'(i mean bad words, like f*** you, your bi***, as*) in English, but I need that. Anyone has or know where I can get a database, txt, whatever of 'bad words or 'palavrões'' zechim http://www.google.com/search?hl=enq=bad+word+dictionarybtnG=Google+Search http://www.google.com/search?hl=enq=bad+word+listbtnG=Searchaq=foq= http://www.google.com/search?hl=enq=bad+word+databasebtnG=Searchaq=foq= Andrew It's not as simple as just blocking the bad words anyway, as people will find clever ways of getting round them such as $hit, sh1t, shi+, etc. Not only that, but just replacing words can cause it's own problems. I remember a lot of early basic filters (Hotmail anyone?) that prevented words like this, and any unfortunate with a surname of Hancock was left in a right mess! Ash www.ashleysheridan.co.uk On my family website, my naive younger sister posted news about her college graduation and had to type magnacumlaude, because she couldn't understand why it kept coming out magna *** laude. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DB Comparisons
On Thu, 2009-02-05 at 21:03 +, Nathan Rixham wrote: revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. honestly, if you're thinking enterprise scale then database is the least of you're worries, you'll be needing to move away from a scripting language and go for a pre compiled programming language. Isn't Yahoo using PHP? I thought Facebook too? Doesn't seem like they moved away from a scripting language. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DB Comparisons
Robert Cummings wrote: On Thu, 2009-02-05 at 21:03 +, Nathan Rixham wrote: revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. honestly, if you're thinking enterprise scale then database is the least of you're worries, you'll be needing to move away from a scripting language and go for a pre compiled programming language. Isn't Yahoo using PHP? I thought Facebook too? Doesn't seem like they moved away from a scripting language. Cheers, Rob. only for the display tier in certain parts AFAIK, facebook had a good success using APC cache; however the bulk of their applications are certainly not php. ie: TIER 1 |-A : many many db servers |--( cluster / distribution point) v | |-B : distributed caches (like terracotta) |-C : entity manager / persistence manager |-D : domain model TIER 2 |-E : business logic |-F : app interface / web service interface |--( cluster / distribution point) v | |-G : web service client TIER 3 |-H : display interface | --( cluster / distribution point) v HTTP | CLIENT |-I : end user client (web browser) that's vastly simplified with loads left out, a short time ago yahoo rolled out 40k new apache hadoop servers - you really think the just bolted a connector on the front ran a few php scripts then popped on some caching? :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DB Comparisons
On Thu, 2009-02-05 at 16:19 -0500, Robert Cummings wrote: On Thu, 2009-02-05 at 21:03 +, Nathan Rixham wrote: revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. honestly, if you're thinking enterprise scale then database is the least of you're worries, you'll be needing to move away from a scripting language and go for a pre compiled programming language. Isn't Yahoo using PHP? I thought Facebook too? Doesn't seem like they moved away from a scripting language. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP As far as DB's are concerned, this is my experience: SQLLite is blindingly fast, but limited in functionality. For most small needs its fine though, and it is free. MySQL is fully powered and very fast, faster than MSSQL and Oracle, and it's free. Oracle is the slowest, but has a lot of features in to safeguard data against accidents, so is the best for critical apps where data loss would be a major issue. As far as I know it's also the most expensive. MSSQL is slow, and you need the latest versions to get the features you need (I'm stuck at work writing work-arounds for apps because they don't want to buy the latest versions!) SQLLite, MySQL and Oracle are all cross-platform, and MSSQL is Windows only. The major languages have modules that let you connect to all of the databases, although I think ASP can only connect to MSSQL and ASP.Net connects only to MSSQL and Oracle (but I'm not 100% certain on this) Also, as far as I'm aware, there are no drawbacks to mixing and matching the various DB's with the various languages. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Bad words [SQL, database, txt, whatever]
On Thu, 2009-02-05 at 15:07 -0600, Shawn McKenzie wrote: Ashley Sheridan wrote: On Wed, 2009-02-04 at 18:34 -0200, Jônatas Zechim wrote: Thank you, but i thought one of you had the .sql or .txt, .xls, etc. I had already find that results. But it's ok now.. zechim -Mensagem original- De: Andrew Ballard [mailto:aball...@gmail.com] Enviada em: quarta-feira, 4 de fevereiro de 2009 18:19 Para: Jônatas Zechim Cc: PHP-General List Assunto: Re: [PHP] Bad words [SQL, database, txt, whatever] On Wed, Feb 4, 2009 at 2:48 PM, Jônatas Zechim zechim@gmail.com wrote: Hi there I don't know how to say 'palavrões'(i mean bad words, like f*** you, your bi***, as*) in English, but I need that. Anyone has or know where I can get a database, txt, whatever of 'bad words or 'palavrões'' zechim http://www.google.com/search?hl=enq=bad+word+dictionarybtnG=Google+Search http://www.google.com/search?hl=enq=bad+word+listbtnG=Searchaq=foq= http://www.google.com/search?hl=enq=bad+word+databasebtnG=Searchaq=foq= Andrew It's not as simple as just blocking the bad words anyway, as people will find clever ways of getting round them such as $hit, sh1t, shi+, etc. Not only that, but just replacing words can cause it's own problems. I remember a lot of early basic filters (Hotmail anyone?) that prevented words like this, and any unfortunate with a surname of Hancock was left in a right mess! Ash www.ashleysheridan.co.uk On my family website, my naive younger sister posted news about her college graduation and had to type magnacumlaude, because she couldn't understand why it kept coming out magna *** laude. -- Thanks! -Shawn http://www.spidean.com It's a mess isn't it? Best way I've found for situations where I need to filter content is to moderate it by hand. It's slow, but is less prone to problems. The moderator has to continually make a mess of things to let bad words through, where a programmer only has to mess it up once and the computer will continue to reject/accept whatever it wants! Also, a human moderator can put context to content, something which even the most sophisticated AI is incapable of. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DB Comparisons
On Thu, 05 Feb 2009 12:36:02 -0800, revDAVE c...@hosting4days.com wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. 1) Define enterprise scale. The word enterprise has no useful meaning other than your software isn't ready for it, therefore you suck. :-) 2) How well do you know your DB? A well-tuned MySQL database will blow the crap out of a default config PostgreSQL server, but a well-tuned PostgreSQL server will wipe the floor with a badly configured mySQL database. Your knowledge of the underlying tool and how to get the most out of it will matter more than which vendor you go with, unless there are very specific features you require. --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Preserving History
Hi gang: To further the Garbage Collection thread on to another level (i.e., preserving history) please consider this: Okay, let's say we have a table containing all the instances of tutors teaching courses. A record might look like this: Course-to-Tutor table course_id = 123 tutor_id = 7 date_active = 2/4/9 date_inactive = null The above record was assembled from the following recrods: Tutor table: id = 7 name = joe Course table: id = 123 title = Introduction to Moonshine Okay, so let's now delete the course Introduction to Moonshine! At the first opportunity to search the Course-to-Tutor table we find that the course 123 is now absent from our database and as such we set the date_inactive field -- it won't be considered again. Okay, so what does that tell us about the history? It only provides that at one time joe taught an undefined course. Furthermore, if joe quits, then we only have a record that says someone with an id of 7 taught a course with an id of 123 -- that doesn't make much sense, does it? Now, if we reconsider the Course-to-Tutor table and instead of putting in the tutor_id and course_id, we put in the actual name of the tutor and title of the class, then at least we have a history that makes sense. However by doing that, we violate the primary principle of a relational database by creating redundant data. I guess that one can say that if we never actually delete the tutor nor the course, but instead just make them inactive as well, then we have solved the problem -- is that the answer? In any event, what problems do you foresee if I used the actual names and titles for the Course-to-Tutor table instead of their id's? After all, the instance records would retain a simple history of what happened regardless of deletions AND a search for Introduction to Moonshine should be essentially as fast as a search for 123 if both fields are indexed, am I right or wrong? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CLI not obeying php.ini
In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DB Comparisons
2009/2/5 Nathan Rixham nrix...@gmail.com: Robert Cummings wrote: On Thu, 2009-02-05 at 21:03 +, Nathan Rixham wrote: revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. honestly, if you're thinking enterprise scale then database is the least of you're worries, you'll be needing to move away from a scripting language and go for a pre compiled programming language. Isn't Yahoo using PHP? I thought Facebook too? Doesn't seem like they moved away from a scripting language. Cheers, Rob. only for the display tier in certain parts AFAIK, facebook had a good success using APC cache; however the bulk of their applications are certainly not php. ie: TIER 1 |-A : many many db servers |--( cluster / distribution point) v | |-B : distributed caches (like terracotta) |-C : entity manager / persistence manager |-D : domain model TIER 2 |-E : business logic |-F : app interface / web service interface |--( cluster / distribution point) v | |-G : web service client TIER 3 |-H : display interface | --( cluster / distribution point) v HTTP | CLIENT |-I : end user client (web browser) that's vastly simplified with loads left out, a short time ago yahoo rolled out 40k new apache hadoop servers - you really think the just bolted a connector on the front ran a few php scripts then popped on some caching? From http://blog.facebook.com/blog.php?post=2223862130... Our Web servers use Linux and Apache and PHP. Our database servers run MySQL. We use memcached to help keep the site snappy. Some of our behind-the-scenes software is written in Python and Perl and Java, and we use gcc and Boost for the parts that aren't. Based on everything I've read there is very very little non-scripted code behind Facebook. The performance of a web-based application rarely has anything to do with the language it's written in. System architecture, caching levels and DB indexes have a far more profound effect on the performance of an app than whether it's compiled or scripted. To the OP: Which DB server you use is far less important than making sure you're using it right and optimising it as much as possible. Sure there are differences between them, and MySQL is better in certain situations than Postgres but a badly configured and optimised Postgres instance will always outperform a well configured and optimised MySQL server. Enterprise doesn't mean anything. if you're going to ask for platform and software performance comparisons you need to provide a lot more detail about what you're building, what skills you have available and what kind of budget you're working to. I've built websites at every level of complexity and every level of user base and I'm yet to find the one size fits all mix of software. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DB Comparisons
Larry Garfield wrote: On Thu, 05 Feb 2009 12:36:02 -0800, revDAVE c...@hosting4days.com wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. 1) Define enterprise scale. The word enterprise has no useful meaning other than your software isn't ready for it, therefore you suck. :-) 2) How well do you know your DB? A well-tuned MySQL database will blow the crap out of a default config PostgreSQL server, but a well-tuned PostgreSQL server will wipe the floor with a badly configured mySQL database. Your knowledge of the underlying tool and how to get the most out of it will matter more than which vendor you go with, unless there are very specific features you require. On top of that, the types of queries you run will have an effect. Mysql works well with simple select * from table where id='x' type queries. Add some subqueries, aggregates (count/sum type thing) and it doesn't perform so well. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preserving History
Hi gang: To further the Garbage Collection thread on to another level (i.e., preserving history) please consider this: Okay, let's say we have a table containing all the instances of tutors teaching courses. A record might look like this: Course-to-Tutor table course_id = 123 tutor_id = 7 date_active = 2/4/9 date_inactive = null The above record was assembled from the following recrods: Tutor table: id = 7 name = joe Course table: id = 123 title = Introduction to Moonshine Okay, so let's now delete the course Introduction to Moonshine! At the first opportunity to search the Course-to-Tutor table we find that the course 123 is now absent from our database and as such we set the date_inactive field -- it won't be considered again. Okay, so what does that tell us about the history? It only provides that at one time joe taught an undefined course. Furthermore, if joe quits, then we only have a record that says someone with an id of 7 taught a course with an id of 123 -- that doesn't make much sense, does it? Now, if we reconsider the Course-to-Tutor table and instead of putting in the tutor_id and course_id, we put in the actual name of the tutor and title of the class, then at least we have a history that makes sense. However by doing that, we violate the primary principle of a relational database by creating redundant data. I guess that one can say that if we never actually delete the tutor nor the course, but instead just make them inactive as well, then we have solved the problem -- is that the answer? In any event, what problems do you foresee if I used the actual names and titles for the Course-to-Tutor table instead of their id's? After all, the instance records would retain a simple history of what happened regardless of deletions AND a search for Introduction to Moonshine should be essentially as fast as a search for 123 if both fields are indexed, am I right or wrong? Cheers, tedd You only need to use ONE value in both tables. tutor_table: tutor_id = 7 first_name = joe last_name = smith active_tutor = Y course_table: course_id = 123 tutor_id = 7 title = Introduction to Moonshine active_course = Y A crude query to return all active tutors and their courses would be: SELECT tutor_table.first_name, tutor_table.last_name, course_table.title FROM tutor_table, course_table WHERE tutor_table.tutor_id = course_table.tutor_id AND tutor_table.active_tutor = 'Y' AND course_table.active_course = 'Y' That will return the course title and tutor name for all active events Hope that helps. Dan
Re: [PHP] DB Comparisons
On Thu, Feb 05, 2009 at 12:36:02PM -0800, revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ).Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. I don't know what backing DMBS Coldfusion uses, but Coldfusion requires server support of a proprietary nature. Likewise, MSSQL is a proprietary product, and I doubt it has the performance characteristics you need. In case it wasn't clear, I would always opt for an Open Source solution before any proprietary one. The arguments are well known. MySQL is not an enterprise database. And its most useful database types are owned by a large corporation which isn't entirely friendly towards the Open Source movement. It's only recently that MySQL has acquired some of the characteristics of enterprise DBMSes. For the longest time, MySQL relied on the programmer to handle his/her own foreign keys and such. It is very fast, and very suitable for web databases. And it has widespread API support in other languages. PostgreSQL *is* an enterprise database. It was designed from the beginning by DBAs, not programmers as MySQL was. It is comparable in performance to Oracle and MySQL, though this depends on the types of queries you're doing. But it has full transactional support, foreign keys, insert appropriate DBMS marketroid terms here. And of course, it it not owned by a company and is fully Open Source. Feel free to flame me about this. I did a survey years ago before selecting PostgreSQL as our internal company DBMS. I've tracked the comparisons over the years, when PostgreSQL lagged in speed behind MySQL and seen PostgreSQL speed up. And I've seen MySQL add full-fledged DBMS features. So their capabilities have come closer and closer together. But I believe PostgreSQL is still the superior choice for an *enterprise* DBMS. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preserving History
tedd wrote: Hi gang: To further the Garbage Collection thread on to another level (i.e., preserving history) please consider this: Okay, let's say we have a table containing all the instances of tutors teaching courses. A record might look like this: Course-to-Tutor table course_id = 123 tutor_id = 7 date_active = 2/4/9 date_inactive = null The above record was assembled from the following recrods: Tutor table: id = 7 name = joe Course table: id = 123 title = Introduction to Moonshine Okay, so let's now delete the course Introduction to Moonshine! At the first opportunity to search the Course-to-Tutor table we find that the course 123 is now absent from our database and as such we set the date_inactive field -- it won't be considered again. Okay, so what does that tell us about the history? It only provides that at one time joe taught an undefined course. Furthermore, if joe quits, then we only have a record that says someone with an id of 7 taught a course with an id of 123 -- that doesn't make much sense, does it? So Joe quits - he has a finishdate or similar flag to say he's not attending the course any more. Now, if we reconsider the Course-to-Tutor table and instead of putting in the tutor_id and course_id, we put in the actual name of the tutor and title of the class, then at least we have a history that makes sense. However by doing that, we violate the primary principle of a relational database by creating redundant data. I guess that one can say that if we never actually delete the tutor nor the course, but instead just make them inactive as well, then we have solved the problem -- is that the answer? Mark the course as not available or something like that but I wouldn't delete it. Like you said, you lose all of the history if you did that. In any event, what problems do you foresee if I used the actual names and titles for the Course-to-Tutor table instead of their id's? After all, the instance records would retain a simple history of what happened regardless of deletions AND a search for Introduction to Moonshine should be essentially as fast as a search for 123 if both fields are indexed, am I right or wrong? The problem there is oops typo - now you either have: - a lot of secondary records to update (redundant data) - have to re-add everyone to the new course. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preserving History
2009/2/5 tedd t...@sperling.com: To further the Garbage Collection thread on to another level (i.e., preserving history) please consider this: Okay, let's say we have a table containing all the instances of tutors teaching courses. A record might look like this: Course-to-Tutor table course_id = 123 tutor_id = 7 date_active = 2/4/9 date_inactive = null The above record was assembled from the following recrods: Tutor table: id = 7 name = joe Course table: id = 123 title = Introduction to Moonshine Okay, so let's now delete the course Introduction to Moonshine! At the first opportunity to search the Course-to-Tutor table we find that the course 123 is now absent from our database and as such we set the date_inactive field -- it won't be considered again. Okay, so what does that tell us about the history? It only provides that at one time joe taught an undefined course. Furthermore, if joe quits, then we only have a record that says someone with an id of 7 taught a course with an id of 123 -- that doesn't make much sense, does it? Now, if we reconsider the Course-to-Tutor table and instead of putting in the tutor_id and course_id, we put in the actual name of the tutor and title of the class, then at least we have a history that makes sense. However by doing that, we violate the primary principle of a relational database by creating redundant data. I guess that one can say that if we never actually delete the tutor nor the course, but instead just make them inactive as well, then we have solved the problem -- is that the answer? This is the way I would approach it. Once you've used an ID in a database you should never reuse it so long as there are references to it in other tables. If you need to exclude it from use you need a flag to indicate that. In any event, what problems do you foresee if I used the actual names and titles for the Course-to-Tutor table instead of their id's? After all, the instance records would retain a simple history of what happened regardless of deletions AND a search for Introduction to Moonshine should be essentially as fast as a search for 123 if both fields are indexed, am I right or wrong? If you need to change any of the names, e.g. to fix a typo, it's potentially a massive update, whereas it's a change to a single row if you use IDs. Another thing to bear in mind is the size of your indexes. IDs are small, strings are not. Having said that it depends on the DB server as some are better at handling string indexes than others. Depending on exactly what your history requirements are it may be worth exploring other options to maintaining a history. One of the sites I work on maintains an audit log such that if something gets deleted that gets recorded in a semi-structured but fairly generic way so if I need to know when record x was deleted from table y and what record x contained I can craft a SQL query to get that from the audit log table, albeit fairly slowly. I also records inserts and updates to create a complete record. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DB Comparisons
On Thu, 2009-02-05 at 21:28 +, Nathan Rixham wrote: Robert Cummings wrote: On Thu, 2009-02-05 at 21:03 +, Nathan Rixham wrote: revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m concerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. honestly, if you're thinking enterprise scale then database is the least of you're worries, you'll be needing to move away from a scripting language and go for a pre compiled programming language. Isn't Yahoo using PHP? I thought Facebook too? Doesn't seem like they moved away from a scripting language. Cheers, Rob. only for the display tier in certain parts AFAIK, facebook had a good success using APC cache; however the bulk of their applications are certainly not php. ie: TIER 1 |-A : many many db servers |--( cluster / distribution point) v | |-B : distributed caches (like terracotta) |-C : entity manager / persistence manager |-D : domain model TIER 2 |-E : business logic |-F : app interface / web service interface |--( cluster / distribution point) v | |-G : web service client TIER 3 |-H : display interface | --( cluster / distribution point) v HTTP | CLIENT |-I : end user client (web browser) that's vastly simplified with loads left out, a short time ago yahoo rolled out 40k new apache hadoop servers - you really think the just bolted a connector on the front ran a few php scripts then popped on some caching? You said move away from scripting, it doesn't seem as though they have. They've merely augmented their system with other tools. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI not obeying php.ini
On Thu, 2009-02-05 at 15:45 -0600, Philip Thompson wrote: In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. ~Philip Depending on what distro (I'm assuming Linux, who would run PHP on anything else? ;) ) you may have a separate php.ini for the CLI. I believe SUSE does this, and it could well be that other distros use a similar model. If you are running SUSE, the config files should be in /etc/php5/ Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI not obeying php.ini
Philip Thompson wrote: In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. Are you including another script (eg pear mail or mbd2 or whatever)? Maybe it's setting something and overriding your attempt. A quick grep would be able to check that. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI not obeying php.ini
On Feb 5, 2009, at 4:17 PM, Ashley Sheridan wrote: On Thu, 2009-02-05 at 15:45 -0600, Philip Thompson wrote: In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. ~Philip Depending on what distro (I'm assuming Linux, who would run PHP on anything else? ;) ) you may have a separate php.ini for the CLI. I believe SUSE does this, and it could well be that other distros use a similar model. If you are running SUSE, the config files should be in /etc/php5/ Ash www.ashleysheridan.co.uk There are other .ini files located in /etc/php.d, but none specify error_reporting... ~Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] CLI not obeying php.ini
-Original Message- From: Philip Thompson [mailto:philthath...@gmail.com] Sent: Thursday, February 05, 2009 3:45 PM To: PHP General list Subject: [PHP] CLI not obeying php.ini In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. In addition to what's already been said, you could try forcing a php.ini file in the current directory by trying the -c command line option. I've done it to try messing with a handful of values here and there for particular scripts. HTH, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI not obeying php.ini
On Feb 5, 2009, at 4:10 PM, Chris wrote: Philip Thompson wrote: In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. Are you including another script (eg pear mail or mbd2 or whatever)? Maybe it's setting something and overriding your attempt. A quick grep would be able to check that. I am including other classes. I did a grep on the whole directory and the only location that had error_reporting was the spot I wrote into my script to force it to E_ERROR. Odd, I know... Thanks, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DB Comparisons
On 2/5/2009 1:03 PM, Nathan Rixham nrix...@gmail.com wrote: Nathan - Thanks so much for your detailed info - much appreciated! On 2/5/2009 1:19 PM, Robert Cummings rob...@interjinn.com wrote: Isn't Yahoo using PHP? I thought Facebook too? Doesn't seem like they moved away from a scripting language. And BTW - it seems as though myspace.com still is using coldfusion. I wonder what the backend db is? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preserving History
On Thu, Feb 05, 2009 at 04:38:25PM -0500, tedd wrote: Hi gang: To further the Garbage Collection thread on to another level (i.e., preserving history) please consider this: Okay, let's say we have a table containing all the instances of tutors teaching courses. A record might look like this: Course-to-Tutor table course_id = 123 tutor_id = 7 date_active = 2/4/9 date_inactive = null The above record was assembled from the following recrods: Tutor table: id = 7 name = joe Course table: id = 123 title = Introduction to Moonshine Okay, so let's now delete the course Introduction to Moonshine! At the first opportunity to search the Course-to-Tutor table we find that the course 123 is now absent from our database and as such we set the date_inactive field -- it won't be considered again. Okay, so what does that tell us about the history? It only provides that at one time joe taught an undefined course. Furthermore, if joe quits, then we only have a record that says someone with an id of 7 taught a course with an id of 123 -- that doesn't make much sense, does it? No. If you're concerned about history, leave the course and tutor records in place. Simply change record in the Course-to-Tutor table. Set the date_inactive field to today's date or whatever. If you're concerned about history, you never delete the records that contribute to a link table. You can delete the record that binds them together in the link table, but not if you want to preserve history. Now, if we reconsider the Course-to-Tutor table and instead of putting in the tutor_id and course_id, we put in the actual name of the tutor and title of the class, then at least we have a history that makes sense. Don't do this. Your searches and indexes will take longer and it will complicate things. Maintain your primary keys as integers. If you want to know the name of the guy who taught course ID 123 from this date to that date, just issue a query which joins the tables. As long as your data is somewhere in these tables (in *one* place, please), you can join tables in a query and get any info you want. However by doing that, we violate the primary principle of a relational database by creating redundant data. While this is true in the ideal world of Codd, in the real world, there is often some minor duplication of data. But in your case, it isn't needed. I guess that one can say that if we never actually delete the tutor nor the course, but instead just make them inactive as well, then we have solved the problem -- is that the answer? In any event, what problems do you foresee if I used the actual names and titles for the Course-to-Tutor table instead of their id's? After all, the instance records would retain a simple history of what happened regardless of deletions AND a search for Introduction to Moonshine should be essentially as fast as a search for 123 if both fields are indexed, am I right or wrong? Not necessarily. In fact, if you add on to this schema, you'll ultimately find that IDs are vastly easier to manage. They make the queries more complex, but the tables are easier to manage. Trust me on this. I've had to go back and redesign tables where I used a long string like a name for the index, and it's generally a bad idea. I expect most DBAs and programmers will agree. Oh, here's another *excellent* reason not to use names: fat fingers. If someone misspells a name or a course title, you can change it to your heart's content if it's just a field in a table. But if it's a key that binds tables together, you can't change it without cascading problems. That key is now in *at least* two places and must be changed *everywhere*, and the DBMS normally won't let you do that. You could add cascade update provisions into your tables, but why? Just use an integer key, and you're away. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI not obeying php.ini
On Feb 5, 2009, at 4:20 PM, Boyd, Todd M. wrote: -Original Message- From: Philip Thompson [mailto:philthath...@gmail.com] Sent: Thursday, February 05, 2009 3:45 PM To: PHP General list Subject: [PHP] CLI not obeying php.ini In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. In addition to what's already been said, you could try forcing a php.ini file in the current directory by trying the -c command line option. I've done it to try messing with a handful of values here and there for particular scripts. HTH, // Todd I tried this as well. No luck. [pthomp...@pthompson scripts]$ php -c /etc -f updateLabels.php labels.log This issue is mainly annoying and not really a bigger issue b/c clients don't see it. Hrm. Oh well. Still open to suggestions. Should I try kicking my (virtual) machine? =D ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sometime the code works and sometimes doesn't
I would also suggest that you hash the passwords at least (better even with a salt value) and then reset the password to something random before sending it to the user. Email can be sniffed relatively easily and this would expose a possible carefully chosen password by the user and then they have to think of something new which they probably forget (although, they probably forgot the password in the first case :-). Maybe there is a possibility that you have 2 or more user records with the same email address? because then the result count would not be 1. Cheers, Tim Tim-Hinnerk Heuer http://www.ihostnz.com On Sat, Jan 17, 2009 at 5:21 AM, Chris Carter chandan9sha...@yahoo.comwrote: Hi, Here is a code for PHP password sending. There is some strange thing happening. This code DOES WORK but not always. So I might be able to get the password in my mailbox once but not always. What could be wrong. ? // database information $host = 'xxx'; $user = 'xxx'; $password = 'xxx'; $dbName = 'xxx'; // connect and select the database $conn = mysql_connect($host, $user, $password) or die(mysql_error()); $db = mysql_select_db($dbName, $conn) or die(mysql_error()); // value sent from form $emailAddress=$_POST['emailAddress']; $sql=SELECT password FROM mytable WHERE emailAddress='$emailAddress'; $result=mysql_query($sql); // keep value in variable name $count $count=mysql_num_rows($result); // compare if $count =1 row if($count==1){ $rows=mysql_fetch_array($result); // keep password in $your_password $your_password=$rows['password']; $subject=Your password is retrieved; $header=from: Great Siteno-re...@somesite.com; $messages= Hi \n\n Your password for login to our website is retrieved.\n\n; $messages.=Your password is '$your_password' \n\n; $messages.=You can use this password; // send email $sentmail = mail($emailAddress, $subject, $messages, $header); } // else if $count not equal 1 else { echo Not found your email in our database; } // if your email succesfully sent if($sentmail){ echo Your Password Has Been Sent To Your Email Address.; } else { echo Cannot send password to your e-mail address; } ? There must be something that I am doing wrong. Otherwise I could have always gotten the password in my mailbox. Please help. Thanks in advance, Chris -- View this message in context: http://www.nabble.com/Sometime-the-code-works-and-sometimes-doesn%27t-tp21502951p21502951.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function_exists question
Why can't you update to Version 5? I might be a bit anal about trying to always get the newest version of everything, but seriously version 3 has surely more known security issues as well as performance costs. What's the cost of upgrading compared to the cost of writing code that works in every version? I think upgrading the system to PHP 5 will take you maybe half an hour, while you can spend a lot more hours on writing backward compatible code. PHP is not very good with compatibility across versions anyway. Hopefully all PHP 5 code will work in PHP 6. How about this PHP developers: You could make a global variable (or constant) the user can set like define('PHP_COMPATIBLE_VERSION', '5.0.1'); or something to tell PHP 6 to interpret it like PHP 5.x . That way, at least you are guaranteed that the code will work like on that version. It might make PHP 6 (a lot?) bigger but it might be worth the cost, since all Sites written in PHP will still work. The functions could still have a performance boost that way if there are better algorithms. Sorry for steeling the thread. Regards, Tim Tim-Hinnerk Heuer http://www.ihostnz.com On Fri, Feb 6, 2009 at 12:55 AM, Thodoris t...@kinetix.gr wrote: Is there a way to check not only if a function exists, but also to check that the number and types of parameters desired match a function definition? The reason being that additional options have been added in php 4 and 5 to various standard function calls, but I'm still running a php3 and php4 server in addition to a php5 server. I would like to make sure that certain extended function calls still work in all versions (or I'll perform the tasks manually, albeit less efficiently). One example I can think of is the round() function. The $precision parameter was added in php4, so will not work in php3. However, function_exists would return TRUE for both 3 and 4, but round itself would fail if I tried to send a precision level to the php3 server. Thanks much, Matt P.S. Of course the modified function_exists would unfortunately have to be a recognized function/method in php3 in order for me to call it to check parameter counts on a php3 server :( I am sure you have some good reasons for keeping php3 right? Why don't you consider updating to at least php4 ?? PHPv3 is not even maintained and PHPv4 is not being developed any more. So by the end of this year (I hope) we will start using a stable PHPv6. IMHO you should consider changing your code (if this is possible) to a more mainstream version. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] function_exists question
-Original Message- From: th.he...@gmail.com [mailto:th.he...@gmail.com] On Behalf Of German Geek Sent: Thursday, February 05, 2009 5:02 PM To: t...@kinetix.gr Cc: Matt Pagel; php-general@lists.php.net Subject: Re: [PHP] function_exists question Why can't you update to Version 5? I might be a bit anal about trying to always get the newest version of everything, but seriously version 3 has surely more known security issues as well as performance costs. What's the cost of upgrading compared to the cost of writing code that works in every version? I think upgrading the system to PHP 5 will take you maybe half an hour, while you can spend a lot more hours on writing backward compatible code. PHP is not very good with compatibility across versions anyway. Hopefully all PHP 5 code will work in PHP 6. How about this PHP developers: You could make a global variable (or constant) the user can set like define('PHP_COMPATIBLE_VERSION', '5.0.1'); or something to tell PHP 6 to interpret it like PHP 5.x . That way, at least you are guaranteed that the code will work like on that version. It might make PHP 6 (a lot?) bigger but it might be worth the cost, since all Sites written in PHP will still work. The functions could still have a performance boost that way if there are better algorithms. Sorry for steeling the thread. Regards, Tim Tim-Hinnerk Heuer http://www.ihostnz.com On Fri, Feb 6, 2009 at 12:55 AM, Thodoris t...@kinetix.gr wrote: Is there a way to check not only if a function exists, but also to check that the number and types of parameters desired match a function definition? The reason being that additional options have been added in php 4 and 5 to various standard function calls, but I'm still running a php3 and php4 server in addition to a php5 server. I would like to make sure that certain extended function calls still work in all versions (or I'll perform the tasks manually, albeit less efficiently). One example I can think of is the round() function. The $precision parameter was added in php4, so will not work in php3. However, function_exists would return TRUE for both 3 and 4, but round itself would fail if I tried to send a precision level to the php3 server. Thanks much, Matt P.S. Of course the modified function_exists would unfortunately have to be a recognized function/method in php3 in order for me to call it to check parameter counts on a php3 server :( I am sure you have some good reasons for keeping php3 right? Why don't you consider updating to at least php4 ?? PHPv3 is not even maintained and PHPv4 is not being developed any more. So by the end of this year (I hope) we will start using a stable PHPv6. IMHO you should consider changing your code (if this is possible) to a more mainstream version. I think it would be much easier to run several versions of PHP in tandem on the same server, and let an .htaccess file (or some other such convention) determine the version of PHP to run particular files/directories/etc. with. My 2c, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function_exists question
How about this PHP developers: You could make a global variable (or constant) the user can set like define('PHP_COMPATIBLE_VERSION', '5.0.1'); or something to tell PHP 6 to interpret it like PHP 5.x . That way, at least you are guaranteed that the code will work like on that version. It might make PHP 6 (a lot?) bigger but it might be worth the cost, since all Sites written in PHP will still work. The functions could still have a performance boost that way if there are better algorithms. php5 introduced this: http://au.php.net/manual/en/ini.core.php#ini.zend.ze1-compatibility-mode to make sure php5 interpreted php4 code in a b/c way, they may do something similar for php6 - php5. Doing it at runtime is silly imo. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] German characters Ö,Ä etc. show up as ?
Do they show up as ? just in the web page or in the source returned? Did you check the source of the page? I had this problem before and as far as i remember, i just needed to encode them like oe (have an american keyboard ;-) ouml; etc. If it's a literal ? in the source, it's PHP and you might need to set your php.ini in some way to support your character set. Have a look into Unicode as well. I haven't had this problem for a while since i don't live in Germany anymore, but i'm sure i will probably come across this some day ;-). Good luck! Regards, Tim Tim-Hinnerk Heuer http://www.ihostnz.com On Fri, Feb 6, 2009 at 1:37 AM, Merlin Morgenstern merli...@fastmail.fmwrote: Hi there, I recently upgraded on my prod system from php 4.x to the newest php version. Now german characters lik Ö show up as ?. I have the same setup running on a test server, where the characters show up OK. After searching on Google I found that there is an entry in the php.ini: default_charset = iso-8859-1 which could help me, however this is not set in the test environment! How come? Is there another way to fix this? Kind regards,Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] German characters Ö,Ä etc. show up as ?
On Fri, 2009-02-06 at 12:23 +1300, German Geek wrote: Do they show up as ? just in the web page or in the source returned? Did you check the source of the page? I had this problem before and as far as i remember, i just needed to encode them like oe (have an american keyboard ;-) ouml; etc. If it's a literal ? in the source, it's PHP and you might need to set your php.ini in some way to support your character set. Have a look into Unicode as well. I haven't had this problem for a while since i don't live in Germany anymore, but i'm sure i will probably come across this some day ;-). Good luck! Regards, Tim Tim-Hinnerk Heuer http://www.ihostnz.com On Fri, Feb 6, 2009 at 1:37 AM, Merlin Morgenstern merli...@fastmail.fmwrote: Hi there, I recently upgraded on my prod system from php 4.x to the newest php version. Now german characters lik Ö show up as ?. I have the same setup running on a test server, where the characters show up OK. After searching on Google I found that there is an entry in the php.ini: default_charset = iso-8859-1 which could help me, however this is not set in the test environment! How come? Is there another way to fix this? Kind regards,Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If the source has been saved with literal ? characters, then you may need to add them all over again. I'm assuming though that the source is fine, as it's working on your test server. Have you tried altering the character encoding through a meta tag? I had this issue where it was showing ? characters until I changed the meta tag to utf-8. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] German characters Ö,Ä etc. show up as ?
On Thu, Feb 5, 2009 at 7:37 AM, Merlin Morgenstern merli...@fastmail.fm wrote: Hi there, I recently upgraded on my prod system from php 4.x to the newest php version. Now german characters lik Ö show up as ?. I have the same setup running on a test server, where the characters show up OK. After searching on Google I found that there is an entry in the php.ini: default_charset = iso-8859-1 which could help me, however this is not set in the test environment! How come? Is there another way to fix this? Kind regards,Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php header('Content-Type: text/html; charset=utf-8'); You might want to get with the current century and consider utf8! :D I'll leave you to your own devices on regressing that. -- http://www.voom.me | EFnet: #voom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: DB Comparisons
Asp(.net) has no real problems connecting to mysql. But it's slower than php. Bastien Sent from my iPod On Feb 5, 2009, at 16:39, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Thu, 2009-02-05 at 16:19 -0500, Robert Cummings wrote: On Thu, 2009-02-05 at 21:03 +, Nathan Rixham wrote: revDAVE wrote: Hi Folks, I¹m curious if there are any previous discussions / Articles / URL¹s that compare the power and scalability of MySQL (with php) with other technologies like MS sequel server oracle - coldfusion etc I imagine that most middleware like php / asp / coldfusion is relatively good fast - (let me know if one is better ). Mostly I¹m con cerned with the speed and power of the backend database as to how it functions on an enterprise scale such as how many hits it can handle per hour how many users before it starts to slow down etc. honestly, if you're thinking enterprise scale then database is the least of you're worries, you'll be needing to move away from a scripting language and go for a pre compiled programming language. Isn't Yahoo using PHP? I thought Facebook too? Doesn't seem like they moved away from a scripting language. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP As far as DB's are concerned, this is my experience: SQLLite is blindingly fast, but limited in functionality. For most small needs its fine though, and it is free. MySQL is fully powered and very fast, faster than MSSQL and Oracle, and it's free. Oracle is the slowest, but has a lot of features in to safeguard data against accidents, so is the best for critical apps where data loss would be a major issue. As far as I know it's also the most expensive. MSSQL is slow, and you need the latest versions to get the features you need (I'm stuck at work writing work-arounds for apps because they don't want to buy the latest versions!) SQLLite, MySQL and Oracle are all cross-platform, and MSSQL is Windows only. The major languages have modules that let you connect to all of the databases, although I think ASP can only connect to MSSQL and ASP.Net connects only to MSSQL and Oracle (but I'm not 100% certain on this) Also, as far as I'm aware, there are no drawbacks to mixing and matching the various DB's with the various languages. Ash www.ashleysheridan.co.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
[PHP] How can I use a function's default arguments but change one of the end ones in the list?
Is there a way to use the default values of a function without specifying every single one until the parameter you want to modify in PHP5 ? I don't see it here, but feel this would be very useful indeed. http://www.php.net/manual/en/functions.arguments.php So given a function that takes seven parameters, I want to change one of them and leave the other defaults alone... ?php function SQL_QUERY($sql, $parameters = null, $showSQL = false, $showErrors = true, $execute = true, $noHTML = false, $profile = 0) { var_dump($sql, $parameters, $showSQL, $showErrors, $execute, $noHTML, $profile); } ? pre ?php SQL_QUERY('SELECT * FROM foo WHERE bar = ?'); ? /pre hr pre ?php SQL_QUERY('SELECT * FROM foo WHERE bar = ?', array('beep'), true); ? /pre hr pre ?php SQL_QUERY('SELECT * FROM foo WHERE bar = ?', array('beep'), $execute=false); ? /pre outputs: --- string(31) SELECT * FROM foo WHERE bar = ? NULL bool(false) bool(true) bool(true) bool(false) int(0) --- string(31) SELECT * FROM foo WHERE bar = ? array(1) { [0]= string(4) beep } bool(true) bool(true) bool(true) bool(false) int(0) --- string(31) SELECT * FROM foo WHERE bar = ? array(1) { [0]= string(4) beep } bool(false) bool(true) bool(true) -- I would have expected this one to be bool(false) bool(false) int(0) The above function call doesn't error out on me, it just seems it doesn't do anything either :-\ So it seems I have to do this verboseness (AND know what the default values are to begin with too): SQL_QUERY('SELECT * FROM foo WHERE bar = ?', array('beep'), false, true, false, false); Just to change one default parameter?!? :-(
Re: [PHP] Email configuration
Thanks guys, I'm gonna read all this staff, and let you know if have some issues. Thanks a lot --- On Thu, 2/5/09, Yannick Mortier mvmort...@googlemail.com wrote: From: Yannick Mortier mvmort...@googlemail.com Subject: Re: [PHP] Email configuration To: t...@kinetix.gr Cc: itmaqu...@yahoo.com, php-general@lists.php.net Date: Thursday, February 5, 2009, 3:19 PM 2009/2/5 Thodoris t...@kinetix.gr: I think that the OP mentioned the word fedora somewhere above... Oh sorry, I'm so stupid... Anyways, if you want to send mail to large providers you'll need to use a relay. I found a nice tutorial about how to set it up with google apps. It was for Ubuntu but you just have to install msmtp and follow the other steps. Here it is: http://nanotux.com/blog/the-ultimate-server/4/#l-mail I did it on my little gentoo server here at home and it works great. -- Currently developing a browsergame... http://www.p-game.de Trade - Expand - Fight Follow me at twitter! http://twitter.com/moortier -- 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] Clarity needed
Daniel Brown schreef: On Thu, Feb 5, 2009 at 07:56, Jochem Maas joc...@iamjochem.com wrote: and the answer to you Q, like everyone else said: yup :-) PS - given you unlimited resources you might consider doing a charitable donation to FoxNews aficionados :-) Or reminding you how to speak English, Jochem. What the hell are you trying to say here?!? ;-P that tedd's unlimited educational resources (tutors/courses) might go someway to undoing all the harm Fox News inflicts on the masses. Man, a guy disappears for a while and his speech goes to gibberish almost as bad as my own. ;-P almost :-P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I use a function's default arguments but change one of the end ones in the list?
On Thu, Feb 5, 2009 at 18:50, Daevid Vincent dae...@daevid.com wrote: Is there a way to use the default values of a function without specifying every single one until the parameter you want to modify in PHP5 ? Daevid, Check out func_get_args(): http://php.net/func_get_args Then you can rename your sql_query() function to real_sql_query() and create a new sql_query() as a wrapper function with func_get_args() in place of statically-defined variables. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clarity needed
Jochem Maas wrote: Daniel Brown schreef: On Thu, Feb 5, 2009 at 07:56, Jochem Maas joc...@iamjochem.com wrote: and the answer to you Q, like everyone else said: yup :-) PS - given you unlimited resources you might consider doing a charitable donation to FoxNews aficionados :-) Or reminding you how to speak English, Jochem. What the hell are you trying to say here?!? ;-P that tedd's unlimited educational resources (tutors/courses) might go someway to undoing all the harm Fox News inflicts on the masses. Man, a guy disappears for a while and his speech goes to gibberish almost as bad as my own. ;-P almost :-P Or fox may go someway towards dulling the socialist propaganda of the tutors/courses. We're headed there, but thank God I'm not schreefing from an insanely socialist country! :-) -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preserving History
Dan Shirah schreef: Hi gang: To further the Garbage Collection thread on to another level (i.e., preserving history) please consider this: Okay, let's say we have a table containing all the instances of tutors teaching courses. A record might look like this: Course-to-Tutor table course_id = 123 tutor_id = 7 date_active = 2/4/9 date_inactive = null The above record was assembled from the following recrods: Tutor table: id = 7 name = joe Course table: id = 123 title = Introduction to Moonshine Okay, so let's now delete the course Introduction to Moonshine! At the first opportunity to search the Course-to-Tutor table we find that the course 123 is now absent from our database and as such we set the date_inactive field -- it won't be considered again. Okay, so what does that tell us about the history? It only provides that at one time joe taught an undefined course. Furthermore, if joe quits, then we only have a record that says someone with an id of 7 taught a course with an id of 123 -- that doesn't make much sense, does it? Now, if we reconsider the Course-to-Tutor table and instead of putting in the tutor_id and course_id, we put in the actual name of the tutor and title of the class, then at least we have a history that makes sense. However by doing that, we violate the primary principle of a relational database by creating redundant data. I guess that one can say that if we never actually delete the tutor nor the course, but instead just make them inactive as well, then we have solved the problem -- is that the answer? In any event, what problems do you foresee if I used the actual names and titles for the Course-to-Tutor table instead of their id's? After all, the instance records would retain a simple history of what happened regardless of deletions AND a search for Introduction to Moonshine should be essentially as fast as a search for 123 if both fields are indexed, am I right or wrong? Cheers, tedd You only need to use ONE value in both tables. tutor_table: tutor_id = 7 first_name = joe last_name = smith active_tutor = Y course_table: course_id = 123 tutor_id = 7 title = Introduction to Moonshine active_course = Y A crude query to return all active tutors and their courses would be: SELECT tutor_table.first_name, tutor_table.last_name, course_table.title FROM tutor_table, course_table WHERE tutor_table.tutor_id = course_table.tutor_id AND tutor_table.active_tutor = 'Y' AND course_table.active_course = 'Y' I would use a more generic field that 'active_tutor', et al something like 'state' ... and make it an ENUM field with some values which you could later extend, e.g. active deceased incapacitated inactive fired a different set of states could be defined for courses: active inactive deleted you might also consider some kind of transaction table to store state changes ... or defer to Nate Rixham about using geospatial indexes (storing id+timestamp as primary key ... thereby creating a new record for each change in the data) @Nathan ... sorry if I spelt your name wrong, it's late and a bottle of wine has been emptied. That will return the course title and tutor name for all active events Hope that helps. Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI not obeying php.ini
Philip Thompson wrote: In my php.ini, I have error_reporting = E_ALL ~E_NOTICE When I run a script from the command line, I get a lot of notices even when I said I don't want them. Also, in my script, I specified error_reporting(E_ERROR) in attempts to explicitly tell it what I want. It doesn't work either. Why am I still getting notices?! BTW, I don't receive notices via a web browser, just CLI. I double-checked to see what INI file was loaded and it's the one I expected to see: [pthomp...@pthompson scripts]$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Thoughts on what's happening would be awesome! Thanks in advance. ~Philip Run this to find out which ini file is being parsed: php -i | grep ini Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I use a function's default arguments but change one of the end ones in the list?
I've thought about this problem before but couldn't think of a solution either. How does func_get_args() solve this? You could make a wrapper function without that. How would u (php) know which parameter u mean in a particular case? I think it would just be useful to have an IDE that can write out the default parameters on a keyboard shortcut or mouse click and then u can change them afterwards. Cheers, Tim Tim-Hinnerk Heuer http://www.ihostnz.com On Fri, Feb 6, 2009 at 1:56 PM, Daniel Brown danbr...@php.net wrote: On Thu, Feb 5, 2009 at 18:50, Daevid Vincent dae...@daevid.com wrote: Is there a way to use the default values of a function without specifying every single one until the parameter you want to modify in PHP5 ? Daevid, Check out func_get_args(): http://php.net/func_get_args Then you can rename your sql_query() function to real_sql_query() and create a new sql_query() as a wrapper function with func_get_args() in place of statically-defined variables. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Unadvertised dedicated server deals, too low to print - email me to find out! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I use a function's default arguments but change one of the end ones in the list?
Daevid Vincent wrote: Is there a way to use the default values of a function without specifying every single one until the parameter you want to modify in PHP5 ? I don't see it here, but feel this would be very useful indeed. http://www.php.net/manual/en/functions.arguments.php So given a function that takes seven parameters, I want to change one of them and leave the other defaults alone... The above function call doesn't error out on me, it just seems it doesn't do anything either :-\ So it seems I have to do this verboseness (AND know what the default values are to begin with too): SQL_QUERY('SELECT * FROM foo WHERE bar = ?', array('beep'), false, true, false, false); Just to change one default parameter?!? :-( What you are wanting to do is not possible. Back in the day, I worked on a project that used our own variation of this type of functionality. We had this function that helped a little function alternate($a, $b) { return $a = ( $a ? $a : $b ); } function query($sql, $params=array()) { alternate($params, array()); extract($params); alternate($parameters, null); alternate($showSQL, false); alternate($showErrors, true); alternate($execute, true); alternate($noHTML, false); alternate($profile, 0); # Do your thing... } This allowed for us to include/exclude whatever we wanted from the it is a little long winded to get to what you are looking for ( I think ) But it worked for us. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I use a function's default arguments but change one of the end ones in the list?
German Geek wrote: I've thought about this problem before but couldn't think of a solution either. How does func_get_args() solve this? You could make a wrapper function without that. How would u (php) know which parameter u mean in a particular case? I think it would just be useful to have an IDE that can write out the default parameters on a keyboard shortcut or mouse click and then u can change them afterwards. Cheers, Tim Tim-Hinnerk Heuer http://www.ihostnz.com Well, using func_get_args() you can pass whatever you want and parse the args to see what was passed and assign default values if a specific arg wasn't passed. I however would probably pass an associative array to the func and parse that. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php