0

I'm stuck with this query as it isn't returning any information at all from the database, what have I done wrong? Mostly just need to know why the current function isn't returning anything.

public $perpage = 10; // Uploads perpage
PUBLIC FUNCTION Updates( $uiD, $lastid ){
    $data = "";
    $morequery = "";
        if( $lastid )
            $morequery = "AND M.post_iD < '".$lastid."' "; // More Button End
            $sth = $this->db->prepare("
                                        SELECT M.post_iD, M.uid_fk, M.message, M.created, U.username, M.uploads
                                        FROM Posts M, users U
                                        WHERE U.status = '1' AND M.uid_fk = U.uiD AND M.uid_fk = '$uiD' $morequery
                                        ORDER BY M.post_iD DESC limit" .$this->perpage);
            while( $row = $sth->fetchAll(PDO::FETCH_ASSOC) ){
                $data = $row;
            }
        return $data;
    }
Attis
  • 124
  • 13
  • Does your MySQL statement alone returns the information you need? – Neigyl R. Noval Jun 06 '13 at 10:01
  • @NeigylR.Noval Yes sir, it does. I have three other queries that is part of it, but they return friends updates, that current one should return either way but it doesn't. – Attis Jun 06 '13 at 10:02
  • Please read [PDO query fails but I can't see any errors. How to get an error message from PDO?](http://stackoverflow.com/questions/15990857/reference-frequently-asked-questions-about-pdo#15990858) and then fix your query accordingly – Your Common Sense Jun 06 '13 at 10:16
  • @YourCommonSense, what if there aren't any errors in the query as it's not displaying any. Does that mean that it has nothing to do with the query itself having an error but elsewhere? – Attis Jun 06 '13 at 10:30
  • It is a complete fail, I forgot to add execute -_- – Attis Jun 06 '13 at 10:48

0 Answers0