4 ms·
They removed mysql_real_escape_string function so that you can use mysqli_real_escape_string http://php.net/manual/en/mysqli.real-escape-string.php http://php.n
by iopq 10y ago
They removed mysql_real_escape_string function so that you can use mysqli_real_escape_string http://php.net/manual/en/mysqli.real-escape-string.php http://php.net/manual/en/mysqli.real-escape-string.php
- greyman 10y agoNo, you use PDO::quote().
- CiPHPerCoder 10y agoNo, you use $pdo->prepare("SELECT id FROM foo WHERE bar = ? AND baz = ?") ->execute([$baz, $qux]); ...while taking care to set PDO::ATTR_MODE to PDO::ERRMODE_EXCEPTION and PDO::ATTR_EMULATE_PREPARES to false when your PDO object is initialized. https://github.com/paragonie/airship/blob/8b7edde11b5b57fcb4b46024ca2227fd3cd4fc28/src/Engine/Database.php#L40-L47 https://github.com/paragonie/airship/blob/8b7edde11b5b57fcb4... See also: http://stackoverflow.com/a/12118602/2224584 http://stackoverflow.com/a/12118602/2224584
- roblabla 10y agoThis is the problem I have with PHP. 15 ways to do something seemingly simple, and only one obscure way is correct (What's PDO::ATTR_MODE ?) And why does PDO try to emulate prepares ?
- stephenr 10y agoThat was 4 ways. The documentation identify what the options do.
- stephenr 10y agoNamed parameters are much simpler to use IMO.
- CiPHPerCoder 10y agoSimpler? No. Easier? Yes.