Jump to content

PDO Returns Empty


Go to solution Solved by 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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.