Post by thbr02 » Thu Aug 06, 2015 2:34 am

I'm about to update one of my old vqmods for Opencart 2.0.3.1. It's an extension sending birthday emails to customers. I've managed to update nearly all code, but one thing remains. I can't figure out how to change the while loop in the example below. This is probably a very simple question for experienced programmers, but for a beginner like me it's really hard.

Code: Select all

//Find the customers whose birthday is today
$findCustomers = $this->db->query("SELECT * FROM customer WHERE substr(birth_date,6) = '" . $todayDate . "'");
while($row = mysql_fetch_array($findCustomers)){
   $birthDate = $row['birth_date'];
   $birthEmail = $row['bday_email'];
   $age = $thisYear - (substr($birthDate,0,4));
I would really appreciate any hint how to solve this.
Last edited by thbr02 on Thu Aug 06, 2015 5:03 am, edited 1 time in total.

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by chulcha » Thu Aug 06, 2015 3:11 am

try it

Code: Select all

$findCustomers = $this->db->query("SELECT * FROM customer WHERE substr(birth_date,6) = '" . $todayDate . "'");
foreach ($findCustomers->rows as $row) {
   $birthDate = $row['birth_date'];
   $birthEmail = $row['bday_email'];
   $age = $thisYear - (substr($birthDate,0,4));

Active Member

Posts

Joined
Fri Jul 18, 2014 4:39 pm

Post by thbr02 » Thu Aug 06, 2015 5:03 am

Wov, it works! Thought it would be easy for a pro :) .

Thanks alot!

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden
Who is online

Users browsing this forum: Bing [Bot] and 27 guests