Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6033

Re: pgsql and exception

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: pgsql and exception
Date 2012-05-14 09:40 -0400
Organization A noiseless patient Spider
Message-ID <jor217$nnm$3@dont-email.me> (permalink)
References <4fb0a891$0$1739$426a34cc@news.free.fr> <joqd6d$8bd$1@dont-email.me> <4fb0f971$0$21929$426a74cc@news.free.fr> <a1cdojFsjmU2@mid.uni-berlin.de>

Show all headers | View raw


On 5/14/2012 8:56 AM, M. Strobel wrote:
> Am 14.05.2012 14:24, schrieb Une Bévue:
>> On 14/05/12 09:45, "Álvaro G. Vicario" wrote:
>>> This isn't a database error, it's a PHP error. The line where you define
>>> $ret's current value:
>>>
>>> $ret=$db->query($sql);
>>>
>>> ... failed. Such function should return a object but it didn't
>>> (probably, because it returned FALSE instead).
>>>
>>> «Return Values: A query result resource on success or FALSE on failure.»
>>
>> right, however the PHP error is due to an SQL one :
>> i was attempting to put a string of length>  30 in a column of type "varchar(30)".
>
> how about substr()?
>
> /Str.
>
>

No - you do NOT want to change the user's input!  What if it is, for 
instance, a rather long user name?  Or an email address?

The input field should be limited to the amount of data allowed (30 
characters, in this case).  And if the data coming in are still too 
long, reject it with a message to the user.

Allow the user to determine what he/she wants to put in the field.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 08:39 +0200
  Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 09:10 +0200
  Re: pgsql and exception "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-14 09:34 +0200
    Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 14:17 +0200
      Re: pgsql and exception Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-14 09:38 -0400
        Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 16:59 +0200
  Re: pgsql and exception "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-05-14 09:45 +0200
    Re: pgsql and exception "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-14 10:18 +0200
    Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 14:24 +0200
      Re: pgsql and exception "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-14 14:54 +0200
        Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 15:03 +0200
      Re: pgsql and exception "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-14 14:56 +0200
        Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 15:26 +0200
          Re: pgsql and exception "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-14 22:33 +0200
          Re: pgsql and exception "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-15 09:32 +0200
        Re: pgsql and exception Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-14 09:40 -0400
          Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 17:02 +0200
            Re: pgsql and exception Shake <QUITAESTO@QUITAESTO.NOES> - 2012-05-14 17:19 +0200
              Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-14 20:46 +0200
                Re: pgsql and exception Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-14 14:55 -0400
                Re: pgsql and exception Une Bévue <unbewusstsein@fai.invalid> - 2012-05-15 08:00 +0200
                Re: pgsql and exception Luuk <luuk@invalid.lan> - 2012-05-14 21:48 +0200

csiph-web