Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

foreach (echo one line)

now I want to call email

foreach email
echo email


only want one echo line
$dbdetails = dbfetchsingle("SELECT BillFirstName, BillLastName, company, email, email2 FROM orders WHERE orderid = '$this->orderid'");
$this->dbdetails = $dbdetails;
$this->emails = array($dbdetails['email']);
if(strlen($dbdetails['email2']) > 0) {
     $this->emails[] = $dbdetails['email2'];
}

Open in new window

Avatar of Jerry Miller
Jerry Miller
Flag of United States of America image

Isn't the  orderId a unique identifier in the table? If so, the query should only return 1 row. This would eliminate the need for a 'for each' statement. Use the echo email to see the email value returned from the query.
yeah use GROUP BY  email, email2
Avatar of rgb192

ASKER

so what is the echo command or the changed code
ASKER CERTIFIED SOLUTION
Avatar of Jerry Miller
Jerry Miller
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

thanks