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


Groups > comp.lang.php > #7401

Re: adding a method to a built-in class ?

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: adding a method to a built-in class ?
Date 2012-10-30 13:38 +0100
Message-ID <afa034FoaloU1@mid.uni-berlin.de> (permalink)
References <508fc27f$0$1948$426a74cc@news.free.fr>

Show all headers | View raw


Am 30.10.2012 13:05, schrieb Une Bévue:
> newbie to php5, i'd like to know if i could add a method to a built-in class.
> 
> The purpose is to ass #to_sql() method to the String class.
> 
> #to_sql() would just replace any oiccurence of the character "'" by two of it "''".

It looks like you want to program your own sql parameter substitution. You should
rather use the functions like mysqli::real_escape_string(), PDO::quote(), or use
prepared statements.



/Str.

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


Thread

adding a method to a built-in class ? Une Bévue <unbewusst.sein@fai.invalid> - 2012-10-30 13:05 +0100
  Re: adding a method to a built-in class ? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-10-30 13:38 +0100
    Re: adding a method to a built-in class ? Une Bévue <unbewusst.sein@fai.invalid> - 2012-10-30 14:42 +0100
  Re: adding a method to a built-in class ? Gregor Kofler <usenet@gregorkofler.com> - 2012-10-31 11:09 +0100
    Re: adding a method to a built-in class ? Une Bévue <unbewusst.sein@fai.invalid> - 2012-10-31 15:08 +0100
    Re: adding a method to a built-in class ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-02 20:27 +0100

csiph-web