I have a table with store name - product number - email.once the user send new order to the database, I am checking if the product number is matching with the products in this table, if yes the email should be sent to the owner's email in this table.
this is my code, but it is not fetching the data
$ar = explode(",",$productitems);$ar2 = explode(",",$product_qunt);$len= count($ar);$me ='admin22x@gmail.com';$data = mysqli_query($conn, "select * from buyers");$row=mysqli_fetch_array($data);$productids = $row['products'];$productList = explode(",",$productids);$dataemail = mysqli_query($conn, "select email from buyers where products = '$productids'");$row=mysqli_fetch_array($dataemail);$emailto = $row['email'];//to send email for buyersif(in_array($productList, $ar)){ $names=""; if(in_array($productList, $ar) ) { $pr = mysqli_query($conn, "select * from tbl_category where cat_id='$productList'"); $arr= mysqli_fetch_array($pr); $names=$names."<br/>"."المنتج : ".$arr['cat_name']."الكمية : ".$ar2[array_search($productList,$ar2)]; } $subject = 'فاتورةطلبجديد ()'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: '.$adminEmail."\r\n".'Bcc: '.$emailto."\r\n" .'Reply-To: '.$emailto."\r\n" .'X-Mailer: PHP/' . phpversion(); $headers .= 'Bcc: .$adminEmail.'; $htmlContent = $emailto."<br/>"; $htmlContent .= "صاحبالطلب:".$fullname; mail($email, $subject, $htmlContent, $headers);}