troubleshooting Question

Pdo stopping at first number in array and returning null

Avatar of Alex Lord
Alex Lord asked on
* PDOPHPMicrosoft SQL Server
8 Comments1 Solution104 ViewsLast Modified:
So i have it pdo

$emailLists = implode(",'",$emailListIds);

			$stmt = new Database();

			$query = "SELECT
						es.ID AS SAVE_ID,
						es.SEND_DATE AS CREATED,
						es.NAME AS TITLE,
						es.CAMPAIGN_ID AS CAMPAIGN_ID
					FROM schedule_lists sl
						LEFT JOIN TXT2GIVE_EMAIL_SCHEDULE es ON (sl.email_save_id=es.ID)
					WHERE es.ID IN (:emailList) AND es.CHARITY_ID = :clientID
					GROUP BY es.ID";
			$stmt->query( $query );
			$stmt->bind( ':clientID', $clientId );
			$stmt->bind( ':emailList', $emailLists );
			$stmt->execute();
			$result = $stmt->all();

it keeps returning null and i think i know why.

it seems to be going into line
WHERE es.ID IN (:emailList)
and only going to the first id.

which is this here - View of array
also note this is how the array is created -

foreach($result as $emailSaveID){
			if(!empty($emailSaveID)):
				$emailListIds[] = $emailSaveID['EMAIL_SAVE_ID'];
			endif;
		}

what can i do to solve this ?
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros