I'm trying to get somes fields of a DB to import in another DB. So, I've connected to my DB with mysqli.
$mysqli = new mysqli("localhost", "root", "password", "db_name");
if ($mysqli->connect_errno) {
echo "$mysqli->connect_errno";
} else {
echo "You're IN"."<br />";
}
Now, I select the PK of the table:
$emails = $mysqli->query("SELECT email FROM customers WHERE date_first_order IS NOT NULL AND date_first_download IS NOT NULL");
I know that I've an array at this moment in $emails. So, I use a foreach loop.
foreach($emails as $email) {
$email = $email["cl_email"];
$query_name = $mysqli->query("SELECT name FROM customers WHERE email = $email");
$query_lastname = $mysqli->query("SELECT lastname FROM customers WHERE email = $email");
echo $email." ".$query_name." ".$query_lastname."<br />";
}
Here is my problem, with the query_name and query_lastname vars I get an array, an not an String. So, How I can get the field that I'm looking for?
Thanks.