Re: [PHP] Foreign Keys Question
Hey tedd --- Do I understand your structure correctly that you have something like: Courses (table) course_id, subject_id, student1_id, student2_id, student3_id, student4_id, Is that right? Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreign Keys Question
On Dec 11, 2008, at 12:55 PM, Robert Cummings wrote: On Thu, 2008-12-11 at 13:46 -0500, tedd wrote: At 12:29 PM -0600 12/11/08, phphelp -- kbk wrote: Hey tedd --- Do I understand your structure correctly that you have something like: Courses (table) course_id, subject_id, student1_id, student2_id, That was right, but I think I've reconsidered. You see, Richard pointed out the error of my ways, namely: Student attendance should be a table with rows for each student in attendance. If you want to limit the number make a check before adding another student. Don't hard code the number via fields like above or you'll find it overly ugly to add/remove students or even increase the Right, Rob --- As it happens I'm writing an application like this now, in late beta, ready to go live "any day now." I call the table you are describing 'enrollment.' So: - student_id, - (rest of the fields) - enroll_id - student_id - course_id - role_in_class - (more fields) - course_id - subject_id - (more) Except I take it one more step: Instructors are just People, as are Students. The role_in_class field distinguishes what they are doing in the classroom. (We have more roles than those in our application.) Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Foreign Keys Question
In my enrollment database, we keep historical information. My client is a big computer training organization (for which I also teach). The enrollment information is quite fluid -- people are always canceling or rescheduling. It is important for us to know a person's history. $.02 Ken On Dec 12, 2008, at 9:16 AM, tedd wrote: At 2:50 PM + 12/12/08, Colin Guthrie wrote: 'Twas brillig, and tedd at 12/12/08 14:36 did gyre and gimble: That's neat and a lot more powerful than I thought. It's like following a linked list to it's end while removing all traces of the thread. Exactly And I understand the "instructor delete" was not intended. Yeah indeed. I had a db structure in my head and the statement made vague sense with that in mind, but it totally failed to leak through my hands on to the keyboard :P There are three main options here: * ON DELETE CASCADE (if the FK's referenced table has it's record deleted, delete the record here too). * ON DELETE RESTRICT (if the FK's referenced table has it's record deleted stop that whole transaction - e.g. *prevent* the delete). * ON DELETE SET NULL (if the FK's referenced table has it's record deleted, set this tables reference to NULL). All three are useful in different contexts. I use them extensively to ensure good data integrity. The trade off on extra load on insert/update is IMO well worth it. Col Col: That's all good to know. My first tendency is to keep everything. After all, memory is cheap and access times are always reducing. While it's true that having a bunch of worthless data doesn't accomplish anything and slows the process of dealing with it. But, technology in access times and storage capabilities are getting to the point of making the decision to keep/delete worthless data moot. As such, I think the need for FK deletions will become less and perhaps disappear from the language. For some reason, I look upon deletions in similar light as renumbering a table's index after deletion of a record -- like "what's the point?" I'm just rambling -- thanks again for your insight. 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Credit Card processing: Chase PaymenTech
Hello - - --- -- - -- I need to develop Credit Card processing for my current application. We have our own shopping cart. We have been trying in vain to get technical information from PaymenTech for *months* -- but it seems that Chase sold part of it, or split it off into a separate company -- or something. in any case, they seem extremely distracted and unresponsive. By doing some heavy googling, I was able to find some code from a PHP developer's web site, mostly for the format of the xml strings to pass to them. I can't believe that they don't have a processing object for PHP already available, but it seems not. I see in the archives a couple of requests to the group for code, but the most recent was a couple of years old. So, I'll ask again: Anybody have modules, code, tips, land mines, or any other information for doing credit card processing with PaymenTech that you would be willing to share? Many thanks - - - Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Credit Card processing: Chase PaymenTech
Thanks, Guys -- To those who say 'move providers' -- I can't. My client, which also sells a bunch of other stuff on-line has an exclusive arrangement with that processor. How about using gateway providers? Any experience with that? Ken On Dec 15, 2008, at 1:06 AM, clive wrote: phphelp -- kbk wrote: Anybody have modules, code, tips, land mines, or any other information for doing credit card processing with PaymenTech that you would be willing to share? Ken - I think your first step is to find another provider, support is everything, your code can be 110% correct, but if there is 1 item wrong in the comms you have with PaymenTech, then you can spend hours if not days with a broken application. This recently happened with me and HSBC bank in the UK, rubbish support, my code look right, but nothing worked, until after a number of days I managed to get through to one of the developers of there payment gateway system, he was able to a make a few changesto the xml I sending and just like that I was able to process payments. Move providers Clive -- 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] cURL: curl_exec return value
Hey - - - - - - - I am new to using cURL, so I would appreciate your help. Fortunately, I have samples to follow, but the return value is not as I expect. In short, instead of returning a Resource, it is just returning TRUE. I have tried setting: curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TRANSFERTEXT, true); curl_setopt($ch, CURLOPT_HTTPGET, true); I have tried these together and separately and in all combinations. (IOW: flailing blindly) Any clue what I am doing wrong? (relevant code below) Ken Code: - $url = $this->cc_submit_post_url; $ch = curl_init(); // my lines, in any combination curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TRANSFERTEXT, true); curl_setopt($ch, CURLOPT_HTTPGET, true); // these lines are *supposedly* well-tested curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_HEADER, false); // providing a header manually curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); // The following two options are necessary to properly set up SSL curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); $data = curl_exec($ch); if (curl_errno($ch)) { $appl['error_message'] = curl_error($ch); $return_val = FALSE; } else { curl_close($ch); } --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decorator with public methods
On Dec 26, 2008, at 7:53 PM, Larry Garfield wrote: I have an object to which I want to add behavior (methods). I cannot use inheritance here because the object is already of a type or subtype (vis, I am already using inheritance for something else), and because I want to be able to add multiple types of behavior at runtime. If I understand what you are wanting to accomplish, perhaps a simpler solution: Whenever I create a function in a core-level class, I add pre- and post- execution language to it. For example: class foo_bar { function foo () { if (!on_foo()) { return FALSE; } // normal foo code // normal foo code // normal foo code // normal foo code // normal foo code if (!more_foo()) { return FALSE; } } function on_foo() { return TRUE; } function more_foo() { return TRUE; } } -- then in the child class: class child_bar extends foo_bar { function on_foo() { // runtime code // runtime code // runtime code // runtime code return TRUE; // (or FALSE) } } Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] When is an Exception not an Exception?
On Dec 31, 2008, at 2:12 PM, c...@l-i-e.com wrote: Sorry for the noise. Now that I know what is happening, I'm feeling silly for asking. For me, hitting the the "Send" button often suddenly opens my eyes. Too bad there is no "un-Send" button. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone else have trouble with Apple Mail threading this list?
On Dec 31, 2008, at 5:55 PM, Brian Dunning wrote: ... When I hit Reply or Reply All in Mail, it wants to reply directly to the poster, and only CC's the list... That is just the way the list works. (If you look at threads, you will see a fairly-constant stream of reminders to "reply all" to stay on the public listserv). Other lists to which I subscribe don't behave like this. I can't understand why this one does. Even if people remember to "reply all" the recipient gets 2 copies of the reply. (If only the list admin knew of some programmer who could alter this ) All of this is tolerable for the great information exchanged, but it *is* annoying. Ken (Ironically, I initially forgot to "reply all" on this one, so I had to re-do it.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web Development work
Hello -- - Ernie -- -- - Consulting work is a business. Work doesn't fall from the sky. You have to figure out what you do. Not good enough to say "I'm a programmer" -- that and a dollar will get you half-a-cup of coffee at McDonalds. Figure out where your strengths are. Figure out where you have or can cultivate contacts. Spread the word. If you don't have a demonstrable portfolio of projects from your employer or clients that you can show or discuss with others, you had better develop one. Do you have an industry that you know more about than the average developer? Do you have graphics skills, too? Do you understand how a business works? Every unemployed programmer calls himself a Web Developer. Every unemployed graphic designer calls himself a Web Designer. People who have been doing one or both for *years* call themselves the same thing. Most potential customers have no clue who is good or bad. Can you do the design work, or just the programming work. This isn't a place to get work; (based on the nature of your questions) there are 100s of folks here with more experience and savvy than you, and I bet every one of the independents have room for more clients. I have been in this business for 20 years. If you are flailing around asking naive questions like this, you probably are better off with a job. Maybe 10 years ago, someone with mid-level skills and no business acumen could be a successful "web developer" just because the industry was growing so fast and there were so few people with real skills. Now the situation is the opposite: there are lots and lots of people with skills. There are still jobs around, but you have to work harder to get them. If you want to be in business, you need to think like a business person (who just happens to have a technical set of skills). Good luck, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Logical next step in learning?
On Apr 14, 2009, at 10:58 AM, Gary wrote: I think most books have you writing code, and Head First did as well, so I think that is covered.. No, it isn't. There is a big difference between writing it the way a book tells you to do it, hand-holding all the way and doing it. When you actually have to do it, you take what you have read and apply it, using the book as a reference. I actually have a real project to do that is a little beyond my abilities at this point (its my own), so I want to keep the learning process flowing. Bastien's suggestion is spot on. Catalog your family members & friends, shoes, girlfriends, any information that is important to you. Really the only way. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] https and Credit Cards
On Apr 13, 2009, at 10:19 PM, Skip Evans wrote: But doesn't also the form need to be secure since you're sending CC information from that form back to the web site's server? That's what I've always assumed. I need some opinions on this, and if I'm right I think the client will defer to a few more votes. To add to what others have said: CC processors with which I have worked will audit your site *before* certifying your site to accept CC information. In other words, if you don't do SSL, you won't be *allowed* to process cards. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session data files
Hey, folks --- Just something I'm curious about: When I run PHP on my development box (W2K), I just get one session file per connection which gets deleted (usually) after the session expires. When I look at the session files on the client server (linux/apache), there seems to be one session file per page click. I needed to clear them a few minutes ago, and there are already 80+ files, and this is just from one user (a tester -- this is in late-late-late beta). Now, there is nothing wrong -- everything is working fine -- I am just curious if Apache does this differently, or if there is a configuration setting that governs this (I haven't found -- but only did a cursory look). Anybody willing to take the time to enlighten me? Thank you, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session data files
Thanks, Tom - - On May 8, 2009, at 12:37 PM, Tom Worster wrote: On 5/8/09 11:09 AM, "phphelp -- kbk" wrote: Just something I'm curious about: When I run PHP on my development box (W2K), I just get one session file per connection which gets deleted (usually) after the session expires. When I look at the session files on the client server (linux/apache), there seems to be one session file per page click. I needed to clear them a few minutes ago, and there are already 80+ files, and this is just from one user (a tester -- this is in late-late-late beta). Now, there is nothing wrong -- everything is working fine -- I am just curious if Apache does this differently, or if there is a configuration setting that governs this (I haven't found -- but only did a cursory look). Anybody willing to take the time to enlighten me? have you satisfied yourself that what you're seeing is not just an artifact of how the session garbage collector works? http://us.php.net/manual/en/session.configuration.php maybe compare the gc parameters on the two different machines? phpinfo() displays the values. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms validation and creation- easier solution?
On May 20, 2009, at 2:03 AM, Angelo Zanetti wrote: We have done quite a few projects and we are looking to find better ways to implementing forms. This is fairly simple to roll-your-own. I do it from metadata. I check MySQL metadata for data types, lengths, and defaults. In addition, my metadata tables contain: -- field captions -- field-use descriptions and business rules (generates CSS pop-up help) -- the type of control used -- the source of data for controls (I call system codes: like the lists of choices for comboboxes and radio buttons -- I keep almost all of these in a single table.) -- whether data in a field is required -- whether the data in a field are visible, editable, or new-record- only editable -- whether the data are encrypted (core data class handles the encryption/decryption) -- data entry order -- any non-standard user rights to the data. -- Simple business rules (like maximums, minimums and ranges of acceptable values) -- easy validation categories: birthdates, eMail formatting, USA phone numbers & postal codes, US social security #'s, credit card format, and the like. The last two can generate JavaScript, too (still working on that). -- I also am working on more complex validation being automatic: across fields or tables, dependent on other variables, etc. By standardizing the format of metadata and the means of storing system code values, plus core CSS class names, you can use this across projects. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Container or Calling Class
Hey -- folks -- -- - I am trying to figure out one aspect of PHP's object model. Is it good practice to have a class be a property of another class? In other words: class foo_handler { function add_bar() { include bar_class.inc; $this->bar_handler = new bar_handler; } } So one would have language in a foo_handler function like: $this->bar_handler->bar_toast("Rye",$settings); If so, can the bar_handler->bar_toast() function call a function in the container class (foo_handler)? "Parent" is used in some OOP languages for this type of hierarchy, but not PHP. I have fooled around with the scope resolution operator, but either that doesn't do it or I can't nail the syntax. Anyone care to illuminate this for me? Many thanks to all of the contributors to this list for all you do... Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Case Conversion of US Person Names
Hi, All -- -- - - I occasionally find myself in need of a utility to do case conversion of people's names, especially when I am converting data from an old to a new system. This is the first such occasion in PHP. I know about ucwords() and mb_convert_case(). They do not accommodate names with "middle" capitalization. Does anybody have such a utility to share, or know of one posted by someone "out there" that you have used? I am not looking for perfection -- I know that such is not possible. I just want to pick off the easy ones -- Mc, Mac, O', de, de la, van, vander, van der, d' and others like that. I see some novel attempts to do parts of this on the PHP ucwords() "User Notes" area, but I bet someone out there has something more comprehensive. I'd rather not "roll my own" as I have done in other languages. I have Googled without success. Many thanks, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Case Conversion of US Person Names
On Jul 16, 2009, at 1:19 PM, Jônatas Zechim wrote: U can try this: function fNme($n){ $tN=count($n=explode(' ',strtolower($n))); $nR=''; for($i=0;$i<$tN;$i++){if($i==0){$nR.=strlen($n[$i])>3?ucwords($n [$i]):$n[$i] ;}else{$nR.=strlen($n[$i])>3?' '.ucwords($n[$i]):' '.$n[$i];}} return $nR; } echo fNme('a aaa aa aa '); And also make an array inside this function for exceptions like 'vander' or other words which the srtlen is > 3. Thank you. If I "roll my own" function, that could be useful. I'd still rather find one that exists, though. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Case Conversion of US Person Names
On Jul 16, 2009, at 4:06 PM, Leonard Burton wrote: Try this class here: http://code.google.com/p/lastname/ Oo! That looks *very* interesting. Thank you. Have you tried it? Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie - Is there a calendar module for date entry?
Here is a simple but effective one, which has the advantage of optionally doing datetime. -- -- http://www.rainforestnet.com If anyone knows of others that do both date and datetime, I'd love to see them. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include Files in HTML
On Sep 4, 2009, at 5:03 PM, sono...@fannullone.us wrote: Depends on what you are including. The only tags that can be inside the head are , , ,