mysql - PHP Loop with multiple rows -
i have php code:
$number = substr_replace($_post["number"],"44",0,1); $sql="select * channel_did did '%".$number."%' , (client_id = '' or client_id null or client_id = '611') , (extension_id = '' or extension_id null) "; $rs=mysql_query($sql,$pbx01_conn) or die(mysql_error()); while($result=mysql_fetch_array($rs)) { $numbers_list = $result["did"].'<br>'; $email_body = '<font face="arial"> hello, here numbers have requested.<br><br> please aware these numbers in public pool , not reservered, therefore assigned client @ time.<br><br> please make choice possible guarantee number require.<br><br> '.$numbers_list.'<br><br> kind regards,<br><br> customer services<br> integra digital<br><br> tel: 01702 66 77 27<br> email: support@domain.co.uk<br> web: www.integradigital.co.uk </font>'; } echo $email_body; sendemail($_post["emailto"],"integra digital <no-reply@domain.co.uk>","voip phone numbers requested",$email_body,"no-reply@domain.co.uk");
it selects rows table , need email 1 email list of rows
when run sql know there 10 rows (did)
when sends email, using $email_body
variable putting 1 row in email.
i have created $numbers_list
variable should have list of rows 1 row.
create array(), push rows data it.. , use implode()
in $email_body;
try this
while($result=mysql_fetch_array($rs)) { $numbers_list[] = $result["did"]; } $email_body = '<font face="arial"> hello, here numbers have requested.<br><br> please aware these numbers in public pool , not reserved, therefore assigned client @ time.<br><br> please make choice possible guarantee number require.<br><br> '.implode('<br>',$numbers_list).'<br><br> kind regards,<br><br> customer services<br> integra digital<br><br> tel: 01702 66 77 27<br> email: support@integradigital.co.uk<br> web: www.integradigital.co.uk </font>';
and mysql deprecated have mysqli or pdo
Comments
Post a Comment