Code: Select all
SELECT 'Surname', 'Forename`, `customerID`, `email` from `contact_email`, `contacts` where `contactID`=".$contact_id." and `roles_contactID`=".$contact_id." and `default_email`='Y'
Regards,
Moderator: General Moderators
Code: Select all
SELECT 'Surname', 'Forename`, `customerID`, `email` from `contact_email`, `contacts` where `contactID`=".$contact_id." and `roles_contactID`=".$contact_id." and `default_email`='Y'
Code: Select all
SELECT contacts.surname, contacts.forename, contacts.customerid, contact_email.email
FROM contacts
INNER JOIN contact_email ON (contacts.contact_id = contact_email.contact_id)
WHERE contacts.contact_id = $contact_id
AND default_email = 'Y'
Code: Select all
<?php
//if you enclose the query string in double quotes ", you do not need to come out and concatenate in the variable
//just put it in the normal flow (this does not work if you enclose in single quotes ')
$Query = "SELECT contacts.surname, contacts.forename, contacts.customerid, contact_email.email
FROM contacts
INNER JOIN contact_email ON (contacts.contact_id = contact_email.contact_id)
WHERE contacts.contact_id = $contact_id
AND default_email = 'Y'";