Jump to content

PDO Returns Empty


BorysSokolov

Recommended Posts

The below code is part of a function which is supposed to return records from a database but it comes up empty, for some reason.

private function _loadEventData($id=NULL){

                        ......

                        $sql .= "WHERE `event_start` 
						BETWEEN '$start_date' 
						AND '$end_date' 
					ORDER BY `event_start`";
			$stmt = $this->db->prepare($sql);
			
			if(!empty($id)){
				$stmt->bindParam(":id", $id, PDO::PARAM_INT);
			}
			
			$stmt->execute();
			$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
			$stmt->closeCursor();
			
			return $results;
}

I'm not familiar to using PDO, so I'm not sure where the error lies. Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/278878-pdo-returns-empty/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.