Error fatal: usar $ esto cuando no está en el contexto del objeto con la clase contenedora pdo
Frecuentes
Visto 294 veces
0
Estoy utilizando simpleSQL - PDO class in my php application,
and using by this code:
$where['username']=$_POST['username'];
$where['password']=md5($_POST['password']);
$DB = new DB();
$res=$DB->buildQuery('tbl_admin',$where);
it is working fine in localhost, but in online server it get the error this:
Fatal error: Using $this when not in object context in DB.php on line 230
line no. 230 in DB class is:
$ item = $ this- > instance- > quote ($ this- > escape ($ item));
Donde esta mi problema
1 Respuestas
2
It's a bug in the class.
En primera buildQuery
método:
array_walk($where,'DB::prepareDbValues');
Esto llama el prepareDbValues
method statically (therefore, not in object context -> $this
is not defined). To fix this issue, replace it by
array_walk($where,array($this, 'prepareDbValues'));
And report the bug and the fix to the class' author.
Respondido 24 ago 12, 09:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php mysql pdo or haz tu propia pregunta.
you 230 line is in a function in the actual class or is outside of the class? - Mihai Iorga
yes it is in actual class, not outside. .check here simpleSQL - PDO - Kartik it
check php version on localhost and server - Sergey
localhost has version
PHP 5.3.5
and online serverPHP 5.2.17
- Kartik ityes, in local with version 5.2.17 getting the same error. ..is there any solution?. ..because i can't change my server's version. - Kartik it