bcart Posted April 15, 2010 Share Posted April 15, 2010 Hi there I'm not sure if this is a PHP or MySQL problem. I am currently running an exam booking system which at the checkout emails the booking administrator the details of the exams that have been booked. If 1 person completes this then the system works perfectly however if more than 1 person tries to complete the booking at the same time then the email is not sent, it comes up with the following error message; Warning: mail() [function.mail]: Failed to Receive in prog_admin\view_booking.php on line 88 Line 88 reads... mail($to, $subject, $body, $headers); The data gets stored into a mysql database which again works perfectly even when multiple users are booking exams however I get an error message saying.... Could not connect to MySQL: Can't connect to MySQL server on 'localhost' (10056) I'm assuming it's got something to do with the number of connections being opened up with the database at 1 time. Does anyone know how to solve the problem? Any help would be much appreciated. Cheers! Link to comment https://forums.phpfreaks.com/topic/198644-php-mysql-error/ Share on other sites More sharing options...
bcart Posted April 15, 2010 Author Share Posted April 15, 2010 My actual script is this <?php ob_start(); session_start(); //Declare the includes include ('../includes/main.php'); include ('../Connections/mysqli_connect.php'); $ta = $_SESSION['ta_name']; $ref = $_SESSION['ref']; $email = $_SESSION['email']; //Exam Detail Query $order_query = "SELECT * FROM exam_details WHERE ref='$ref' "; //Run the query $result_order_query = @mysqli_query ($dbc, $order_query); $row = @mysqli_fetch_array ($result_order_query); $records = $row[0]; $number = mysqli_num_rows($result_order_query); $learner = $row ['learner']; //Learner Query $learner_query = "SELECT * FROM exam_learner_details WHERE id='$learner' "; //Run the query $result_Learner = @mysqli_query ($dbc, $learner_query); $row_learner = @mysqli_fetch_array ($result_Learner); $records_learner = $row_learner[0]; $i=1; $body = '<h1>Review of Exam Booking</h1>'; do { //Exam Group / Title Query $exam_group = $row['exam_group']; $q_group = "SELECT exam_group FROM exam_group WHERE id='$exam_group'"; $r_group = mysqli_query($dbc, $q_group); $row_group = mysqli_fetch_array($r_group); $exam_title = $row['title']; $q_title = "SELECT title FROM exam_title WHERE id='$exam_title'"; $r_title = mysqli_query($dbc, $q_title); $row_title = mysqli_fetch_array($r_title); //Make the body of the email $body .= ' <h2>' . $row_learner['fname'] . ' ' . $row_learner['sname'] . '</h2> <strong>Exam ' . $i . '</strong><br /><br /> <strong>Exam Date: </strong>' . $row['exam_date'] . '<br /> <strong>Exam Time: </strong>' . $row['exam_time'] . '<br /> <strong>Exam Group: </strong>' . $row_group['exam_group'] . '<br /> <strong>Exam Title: </strong>' . $row_title['title'] . '<br /> <strong>Invigilator: </strong>' . $row['invigilator'] . '<br /> <strong>Method: </strong>' . $row['method'] . '<br /> <strong>Location: </strong>' . $row['location'] . '<br /> <strong>Training Required: </strong>' . $row['training_req'] . '<br /> <strong>Additional Information: </strong>' . $row['comments'] . '<br /> <br /><br />'; $i++; } while ($row = @mysqli_fetch_array ($result_order_query)); //end of do...while loop ?> </div><!--end of left --> <div id="content"> <?php if (isset($_POST['submitted'])) { $to = '[email protected]'; //$to = '[email protected]' . ', ' . '[email protected]'; //$to = '[email protected]' . ', ' . $email; $subject = 'Exam Booking'; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; // Send the email: mail($to, $subject, $body, $headers); // Print a message: echo '<h1>Thank you</h1> <h2>Confirmation</h2> <p>Your request has been submitted successfully and will be dealt with as soon as possible. You will only be contacted if there appears to be a query with your booking. </p> <p>In the meantime if you have any queries or need to make a cancellation please contact either:</p> <ul> <li>Becky Marks (Key Skills Examinations Officer) 01606 734031</li> <li>Ellie Georgieva (Programme Administrator) 01606 734029</li> </ul> <br /> <p>To book another learner onto an exam <a href="add_learner.php">click here</a>.</p> <p>All guidance you may require before and during the exam together with the exam bookings procedure can be found on the intranet under Programme Administration.</p>'; } else { echo $body; echo ' <form action="view_booking.php" method="post" name="form" id="form"> <p>To confirm your booking please click the \'Confirm Booking\' button below.</p> <table border="0" cellspacing="0" cellpadding="5"> <tr> <td><input name="submit" type="submit" value="Confirm Booking"/></td> </tr> </table> <input name="submitted" type="hidden" value="TRUE" /> </form>'; } ?> </div><!--end of content --> <div id="right"> <?php include ('includes/second_menu.php'); ?> <br /><br /> <?php include ('../includes/footer.php'); ?> I have also come across the error message... Warning: mail() [function.mail]: SMTP server response: 503 Bad command sequence in prog_admin\view_booking.php on line 88 Again this only happens when multiple users are booking people onto exams. With only 1 user it's working perfectly! Any ideas? I'm at a total loss!!! Link to comment https://forums.phpfreaks.com/topic/198644-php-mysql-error/#findComment-1042492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.