07-06-2009, 12:53 PM
[eluser]Ickes[/eluser]
[quote author="Chad Fulton" date="1246923557"]
As far as I can see, there is some bug in your code somewhere, unfortunately since I can't see it and your database I don't know what it is.
Try this, for debugging:
[/quote]
Stupid me! There was an issue with my db connection. Thanks everyone for the help on this. Even though it was very painful, and probably painful for all involved, I learned a lot.
By using PDO like this, it does remove it from CodeIgniter's syntax. While the idea with CI is to reduce code by using Active Record, I think I will keep my db stuff in PDO. If someone is against this approach, I would love to hear why. I am definitely open minded for change.
Thanks again everyone!
[quote author="Chad Fulton" date="1246923557"]
As far as I can see, there is some bug in your code somewhere, unfortunately since I can't see it and your database I don't know what it is.
Try this, for debugging:
Code:
//dummy variable
$pass_thru = 5;
$stmt = $this->db->prepare("SELECT * FROM tbl_blog WHERE blog_id <= :test");
$stmt->bindParam(':test', $pass_thru, PDO::PARAM_INT);
// Notice that execute() returns TRUE on success, FALSE on failure
if($stmt->execute()) {
echo count($stmt->fetchAll(PDO::FETCH_ASSOC));
}
else {
print_r($stmt->errorInfo());
}
die;
Stupid me! There was an issue with my db connection. Thanks everyone for the help on this. Even though it was very painful, and probably painful for all involved, I learned a lot.
By using PDO like this, it does remove it from CodeIgniter's syntax. While the idea with CI is to reduce code by using Active Record, I think I will keep my db stuff in PDO. If someone is against this approach, I would love to hear why. I am definitely open minded for change.
Thanks again everyone!