X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8D6CBD1E138 for ; Wed, 18 Feb 2004 20:41:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71065-10 for ; Wed, 18 Feb 2004 16:41:39 -0400 (AST) Received: from diver.highboard.com (ns5.highboard.com [207.44.244.101]) by svr1.postgresql.org (Postfix) with ESMTP id 22AE3D1E133 for ; Wed, 18 Feb 2004 16:41:38 -0400 (AST) Received: from roc-66-67-208-52.rochester.rr.com ([66.67.208.52] helo=swimmer) by diver.highboard.com with asmtp (Exim 4.24) id 1AtYVu-0005qd-QM for pgsql-sql@postgresql.org; Wed, 18 Feb 2004 15:41:46 -0500 Reply-To: From: "Jeremy Smith" To: Subject: Re: Inserting NULL into Integer column Date: Wed, 18 Feb 2004 15:43:13 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - diver.highboard.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - highboard.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/260 X-Sequence-Number: 16950 I've run into this kind of thing before. IT helps if you have an array of all your fields like: $fields = array("field1","field3","last_name"); and then you can foreach across the input: foreach($fields as $f){ if (!$_POST[$f]){ $_POST[$f]='DEFAULT'; } else { $_POST[$f] = "'".$_POST[$f]."'"; } } Wow, great idea. I will definitely do this, thanks alot. Well, you might find yourself rewriting fair portions of your site, but usually you wind up with better code and better checking, so it's a bit of a trade off. No doubt that this is true. Of course even without the better code and error checking, the extra features like stored procedures and automatic row locking was more than enough to make the switch worth it. Thanks again! Jeremy