Login   Register  
PHP Classes
elePHPant
Icontem

Fatal error: Call to undefined method PDO::query_secure()

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PDO Multi Connection Class  >  All threads  >  Fatal error: Call to undefined method PDO::query_secure()  >  (Un) Subscribe thread alerts  
Subject:Fatal error: Call to undefined method PDO::query_secure()
Summary:fatal error pdo query_secure
Messages:6
Author:mfrijmann
Date:2012-02-13 17:50:59
Update:2012-03-08 18:42:16
 

  1. Fatal error: Call to undefined method PDO::query_secure()   Reply  
Picture of mfrijmann
mfrijmann
2012-02-13 17:50:59
i've downloaded you're class and included it in my script:

require_once("class_pdo_db.php");
$db = new wArLeY_DBMS("mysql", "localhost", "xxxx", "xxxx", "xxxx", "");
$db = $db->Cnxn(); //This step is neccesary for create connection to database, and getting the errors in methods.
if($db==false){
die("Error: Cant connect to database.");
}

$params = array(":module@27@INT");
$rows = $db->query_secure("SELECT id,name FROM devices WHERE module > :module;", $params, true);
if($rows!=false){
foreach($rows as $row){
$name = $row["name"];
echo $name . "<br />";
$count++;
}
}
$rows = null;
echo $db->getError();

And i'm getting the following error:
Fatal error: Call to undefined method PDO::query_secure()

on row:
$rows = $db->query_secure("SELECT id,name FROM devices WHERE module > :module;", $params, true);

What i;m i doing wrong?

  2. Re: Fatal error: Call to undefined method PDO::query_secure()   Reply  
Picture of Ignacio Colautti
Ignacio Colautti
2012-02-13 18:10:44 - In reply to message 1 from mfrijmann
This is wrong:
$db = $db->Cnxn();

After that line, $db is PDO object, and not a wArLeY_DBMS one.

Change to this:
if($db->Cnxn() == false)
die("Error: Cant connect to database.");

  3. Re: Fatal error: Call to undefined method PDO::query_secure()   Reply  
Picture of mfrijmann
mfrijmann
2012-02-13 19:04:48 - In reply to message 2 from Ignacio Colautti
I Works!
Thanks for you quick response!

I copied it from the manual:
//First you need include the class file
require("pdo_database.class.php");

//Intance the class
$db = new wArLeY_DBMS("mysql", "10.33.133.133", "test", "root", "", "");
$db = $db->Cnxn(); //This step is neccesary for create connection to database, and getting the errors in methods.
if($db==false){
die("Error: Cant connect to database.");
}

is this a bug in the manual, or .... ?

  4. Re: Fatal error: Call to undefined method PDO::query_secure()   Reply  
Picture of Matias Lecaros
Matias Lecaros
2012-02-26 23:09:09 - In reply to message 2 from Ignacio Colautti
thx! :)

  5. Re: Fatal error: Call to undefined method PDO::query_secure()   Reply  
Picture of Evert Ulises German Soto
Evert Ulises German Soto
2012-03-08 18:40:05 - In reply to message 2 from Ignacio Colautti
Thanks Ignacio for your correct anwer.
I have an error in the manual... now is fixed.

  6. Re: Fatal error: Call to undefined method PDO::query_secure()   Reply  
Picture of Evert Ulises German Soto
Evert Ulises German Soto
2012-03-08 18:42:16 - In reply to message 3 from mfrijmann
mfrijmann so sorry... yes is a little bug in the manual.
and thanks to Ignacio for the quick response.
the bug was fixed in the manual.