Reputation: 5316
I have used sqlite_escape_string()
function in one server and it is working fine.When i use the same code in anther server it throwing an error Call to undefined function sqlite_escape_string()
I am using PDO for connecting the database.
Upvotes: 2
Views: 5428
Reputation: 98
if your php version lower than 5.4 maybe you can use this solution
if php version < 5.4
if(!function_exists('sqlite_escape_string')){
function sqlite_escape_string($string) {
return str_replace("'", "''", $string);
}
}
Upvotes: 2
Reputation: 121
function sqlite_escape_string( $string ){
return SQLite3::escapeString($string);
}
Upvotes: 12
Reputation: 4711
sqlite_escape_string()
is not part of the PDO interface, these are object oriented. Additionally, it is only Sqlite Version 2, while the PDO interface is version 3.
See Installation (which specifies that sqlite_pdo is necessary if you're on windows).
Upvotes: 1
Reputation: 44376
sqlite_escape_string()
function is from sqlite extension whereas pdo_sqlite is "only" a driver for PDO.
You should definitely go for PDO and prepared statements in your projects.
Upvotes: 1
Reputation: 70460
sqlite_escape_string
is part of the SQLite
package, which is distincely different then the PDO_SQLite
package. Go for prepared statements instead of escaping the variables.
Upvotes: 6