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 ?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail
From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: adding a method to a built-in class ?
Date Tue, 30 Oct 2012 13:38:59 +0100
Lines 19
Message-ID <afa034FoaloU1@mid.uni-berlin.de> (permalink)
References <508fc27f$0$1948$426a74cc@news.free.fr>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 5F08pCsbz3tk0n6lqBS9DAZjaUGdX7x+AzyAJ6spHGlnJRfSmWB7ohf1ChvS4X1E8=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
In-Reply-To <508fc27f$0$1948$426a74cc@news.free.fr>
Xref csiph.com comp.lang.php:7401

Show key headers only | 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