i have some trouble here. i m tying to send emails from my database where i have email column and in that column i have number of emails in there but when i try to insert more than 5 emails in my email column the Code i placed to send email is wouldn't be worked.one more thing i worked from 000webhost sever not on localhost.and using mail function. here is my php file <?php if (isset($_POST['submit'])) { $text = $_POST['text']; $user_email = $_POST['user_email']; if ($user_email == '') { $select_id = "<h4><center>select your e-mail id first!</h4></center>"; } elseif ($text) { $sql = "INSERT INTO senior_registered_post (user_id,text,date_time) VALUES ('$user_email','$text')"; mysqli_query($db, $sql); $solution = mysqlI_query($db, "SELECT * FROM senior_registered_users WHERE user_id='" . $_SESSION["user_id"] . "'"); $row = mysqli_fetch_array($solution); $first_name = $row['first_name']; $subject = $row['subject']; $email = $row['email']; $email_list = ""; $sql = "select email from email"; $result = mysqli_query($db, $sql); while ($row = mysqli_fetch_array($result)) { if (!empty($row['email'])) { //if email column is not empty $email_list .= $row['email'] . ","; } } $email_list = rtrim($email_list, ','); //trim the rightmost ',' and remove it e.g abc,abd echo $to = "$email_list"; // add one by one email id and send it $subject = "$subject"; $header = "from:$first_name<$email>"; $message = " $text "; if (mail($to, $subject, $message, $header)) { echo "<div class='alert alert-success alert-dismissable fade in'>"; echo"<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>"; echo"E-mail send succesfully on registered E-mail Addresses"; echo " </div>"; } else { echo '<div class="alert alert-dismissable fade in">'; echo '<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>'; echo ' Error! please Try After Sometime'; echo '</div>'; } } else if ($user_email == '') { $select_id = "<h4><center>select your e-mail id first!</h4></center>"; } else { $textfield = "<h4><center>Please fill-out the Text fields first!</center></h4>"; } } ?>
when i pressed the submit button if email column in my database contain more than 5 emails then its says Error! please Try After Sometime it's worked perfectly under <=5 email but more than that not.please if anybody have any idea were i am getting wrong please help i m new to php. any small help is appreciated.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)