Trying to use a php generating the email address using the ID eg: peopleID from database using query function with people_mysql into an HTML table with array of emails from five people. The database do not have email addresses only peopleID in a field. Email suffix is @dot.com.
To explain better to what I’m talking about.
$peopleid = "12345";
$suffix = "@dot.com";
$email = $peopleid . $suffix;
// where $email then contains "people@dot.com" with MySQL
This is what I’ve come up with with string operator.
mysql> SELECT * FROM 'people';
mysql> SELECT *, CONCAT('peopleID', '@dot.com') AS 'Email' FROM 'people';
I would be grateful if anyone can come a php code.
Your query has a mistake in it. Look at the character just before the @ symbol. It should be a single quote.
MySQL queries return a reference to the results, not the results themselves. So, you then need to fetch each row and perform any actions you need to perform. In this case, you are populating and array named $emails that you can then use in your php code.