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


Groups > comp.lang.php > #12131

Re: PHP sql entry is a godaweful mess

From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.php
Subject Re: PHP sql entry is a godaweful mess
Date 2013-12-04 17:15 +0100
Message-ID <529F5505.7090501@arnowelzel.de> (permalink)
References <MPG.2d0923e0848f8339896b9@news.virginmedia.com>

Show all headers | View raw


Am 04.12.2013 12:35, schrieb bored@now.com:

> I've just decided to update some code so updated myself with the docs
> for mySQL entry cleaning and frankly I am totally confused.
> 
> Can someone point to a very clear and unambigous instruction
> as to how to safely enter data into a mysql database?
> Because I doubt thats even possible with PHP.

It is - just do NOT use mysql but mysqli or PDO.

> We have to contend with stripslashes, magic_quotes, magic_quotes_sybase
> mysql_escape_string, mysql_real_escape_string  and more...

No - you don't have to.

See:

<http://php.net/manual/en/class.mysqli.php>
<http://www.php.net/manual/en/mysqli.prepare.php>
<http://php.net/manual/en/book.pdo.php>
<http://php.net/manual/en/pdo.prepare.php>

> As for mysqli and its unnecessarily obtuse syntax... well I'll be 
> looking for alternatives.

Obtuse syntax? Why?

Maybe you got confused by the fact, that mysqli comes in two flavors:
Procedural - to make it easier to migrate existing code from mysql - and
object oriented.

See <http://php.net/manual/en/mysqli.quickstart.dual-interface.php>



-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

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


Thread

PHP sql entry is a godaweful mess <bored@now.com> - 2013-12-04 11:35 +0000
  Re: PHP sql entry is a godaweful mess Tim Streater <timstreater@greenbee.net> - 2013-12-04 12:37 +0000
  Re: PHP sql entry is a godaweful mess Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-04 08:52 -0500
    Re: PHP sql entry is a godaweful mess bill <william@TechServSys.com> - 2013-12-05 06:13 -0500
      Re: PHP sql entry is a godaweful mess [OT] adrian@poppyrecords.invalid.invalid (Adrian Tuddenham) - 2013-12-05 13:13 +0000
  Re: PHP sql entry is a godaweful mess Arno Welzel <usenet@arnowelzel.de> - 2013-12-04 17:15 +0100
  Re: PHP sql entry is a godaweful mess John Smith <johnsmithjsm@live.com> - 2014-01-06 23:17 -0500

csiph-web