simcoweb Posted July 3, 2007 Share Posted July 3, 2007 My eyes are bugging out trying to spot the error causing this Parse error: parse error, unexpected T_STRING in /home2/wwwseat/public_html/buyers.php on line 48 Here's the code: <?php // include our config files include 'db_config.inc'; // Turn on magic quotes to prevent SQL injection attacks if(!get_magic_quotes_gpc()) set_magic_quotes_runtime(1); // start processing if (isset($_POST['submitted'])) { $errors = array(); // validate the form input if (empty($_POST['Name']) || empty($_POST['Email']) || empty($_POST['Phone'])) { $errors[] = "<font face='Verdana' size='2' color='#FF0000'>Your name, email address and daytime phone number are required. Please complete those fields and resubmit.</font>"; } else { $name = mysql_real_escape_string($_POST['Name']); $phone = mysql_real_escape_string($_POST['Phone']); $email = mysql_real_escape_string($_POST['Email']); } // validate email address format if ($email) { if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $errors[] = $email. " is not a valid email address. Please enter a valid email address.<br/>"; } } else { // run query $address = mysql_real_escape_string($_POST['Address']); $city = mysql_real_escape_string($_POST['City']); $state = mysql_real_escape_string($_POST['State']); $zip = mysql_real_escape_string($_POST['Zip']); $country = mysql_real_escape_string($_POST['Country']); $moving = mysql_real_escape_string($_POST['When_moving']); $where = mysql_real_escape_string($_POST['Where_moving']); $price = mysql_real_escape_string($_POST['Price_range']); $bedrooms = mysql_real_escape_string($_POST['Number_bedrooms']); $sqft = mysql_real_escape_string($_POST['Sqaure_feet']); $comments = mysql_real_escape_string($_POST['Comments']); $date = date("F j, Y, g:i a"); $sql = "INSERT INTO buyers ( Name, Email, Phone, Address, City, State, Zip, Country, When_moving, Where_moving, Price_range, Number_bedrooms, Square_feet, Comments, date) VALUES ('$name', '$email', '$phone', '$address', '$state', '$zip', '$country', '$moving', '$where', '$price', '$bedrooms', '$sqft', '$comments', '$date')"; $results = mysql_query($sql) or die(mysql_error()); if (mysql_affected rows($dbc) == 1){ // Send the E-Mail send_mails(); // redirect to confirmation page header("Location: confirmation.htm"); } else { header("Location: error.htm"); } } } ?> I've commented out line 50 which is send_mails(); function to see if it was something a step ahead of line 48. But that didn't fix it. Line 48 is: if (mysql_affected rows($dbc) == 1){ Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted July 3, 2007 Share Posted July 3, 2007 Line 48 should be: if (mysql_affected_rows($dbc) == 1){ You put a space instead of an underscore between affected and rows. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted July 3, 2007 Author Share Posted July 3, 2007 Aha! Thank you! Sometimes when you stare at it for too long you can't spot the little things. I was concentrating on ; and }'s mostly. Thanks! Quote Link to comment 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.