Ryahn Posted June 2, 2010 Share Posted June 2, 2010 I am most likely missing an ending parameter but I have been trying to get this script to work a few days now. I also get an error when trying to pull data from the database and sending it to an email. <? //Submit Button Command if(isset($_POST['submit'])) { //SQL QUERIES & CONNECTION $con = mysql_connect("localhost","nwrepai1_x54abs","1225ff5d1c"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("nwrepai1_chanreq", $con); //Query to submit to database $sql ="INSERT INTO VIP (vent_user, email, country, number_of_users, number_of_chan_ad, payment_term, payment_type) VALUES ('$_POST[vent_user_vip]','$_POST[vip_email]','$_POST[country]','$_POST[num_users]','$_POST[num_chan_ad]','$_POST[term]','$_POST[pay_type]')"; //Data submitted to database if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } //Pull ID field from table VIP if(isset($_POST['submit'])) { $database = "nwrepai1_chanreq"; $table = "VIP"; $connection = @mysql_connect("localhost","nwrepai1_x54abs","1225ff5d1c") or die(mysql_error()); $db = @mysql_select_db($database, $connection) or die(mysql_error()); $chk_id = "SELECT id FFROM $table"; $chk_id_res = @mysql_query($chk_id,$connection) or die(mysql_error()); $chk_id_num = mysql_num_rows($chk_id_res); if ($chk_id_num !=1) { $error = "COULD NOT PULL"; } else { $sql = "SELECT id FROM $table"; $result = @mysql_query($sql,@connection) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $client = $row['id']; } } //Subject of email $subject = "VIP Quote/Request"; $email = $_POST['vip_email']; $vent_user = $_POST['vent_user_vip']; $country = $_POST['country']; $num_users = $_POST['num_users']; $num_chan_ad = $_POST['num_chan_ad']; $term = $_POST['term']; $paytype =$_POST['pay_type']; $address = getenv("REMOTE_ADDR"); $agent = getenv("HTTP_USER_AGENT"); //Mail To These Address //$to = "[email protected], [email protected]"; $to = "[email protected]"; //$to = "[email protected]"; //Information gathered on the form will be emailed as seen here $body = "Ventrilo Username: $vent_user Email: $email Country: $country Number of that will be using the channel (Estimated): $num_users Number of channel admins $num_chan_ad Payment Term: $term Payment Type: $paytype IP Address: $address ID: $client Other Misc Facts $agent"; mail($to, $subject, $body); header("Location: http://www.gameservers.com/clanpay/?clanid=5ed9e75b6153801770a6490db2fcc960"); } else { echo "Could Not Send"; } mysql_close($con) ?> Parse error: syntax error, unexpected $end in /home/nwrepai1/public_html/ventrilox.com/vipmailer.php on line 98 I dont know what I am doing wrong and I have asked some of buds to help but they havent figured it out yet. Quote Link to comment https://forums.phpfreaks.com/topic/203594-error-submitted/ Share on other sites More sharing options...
dabaR Posted June 2, 2010 Share Posted June 2, 2010 The if statement on the top is never closed. In fact, is all this code only supposed to run if isset($_POST['submit'])? If so, then remove line below //Pull ID field from table VIP if(isset($_POST['submit'])) { Quote Link to comment https://forums.phpfreaks.com/topic/203594-error-submitted/#findComment-1066468 Share on other sites More sharing options...
Ryahn Posted June 2, 2010 Author Share Posted June 2, 2010 OK I did, well now I am getting a completely different error. Could Not Send Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/nwrepai1/public_html/ventrilox.com/vipmailer.php on line 96 The Could Not Send is an output by the else statement Quote Link to comment https://forums.phpfreaks.com/topic/203594-error-submitted/#findComment-1066474 Share on other sites More sharing options...
kenrbnsn Posted June 2, 2010 Share Posted June 2, 2010 You don't need to use mysql_close(), since PHP will automatically close the connection when the script exits. Ken Quote Link to comment https://forums.phpfreaks.com/topic/203594-error-submitted/#findComment-1066475 Share on other sites More sharing options...
Ryahn Posted June 2, 2010 Author Share Posted June 2, 2010 Ok that got rid of the errors but now its just not sending. I cant see why. Quote Link to comment https://forums.phpfreaks.com/topic/203594-error-submitted/#findComment-1066476 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.