tqla Posted December 11, 2007 Share Posted December 11, 2007 Hello. This is weird and I know it's something simple but I can't figure it out. Look at the code below. I can see all of the variables from the 'echo' test, but the DB does not get populated. Does the DB part look right? I don't get DB errors so I know that it is connected, and the DB table name is correct. ??? /* if data is good */ $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $title = $_POST['title']; $company = $_POST['company']; $street = $_POST['street']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $telephone = $_POST['telephone']; $email = $_POST['email']; $annual_revenue = $_POST['annual_revenue']; $mailboxes = $_POST['mailboxes']; $email_app = $_POST['email_app']; $email_app_other = $_POST['email_app_other']; $future_app = $_POST['future_app']; $future_app_other = $_POST['future_app_other']; $archiving = $_POST['archiving']; $email_satisfaction = $_POST['email_satisfaction']; $interest = $_POST['interest']; /* Test to see if variable took */ echo "$createDate, $firstName, $lastName, $title, $company, $street, $city, $state, $zip, $telephone, $email, $annual_revenue, $mailboxes, $email_app, $email_app_other, $future_app, $future_app_other, $archiving, $email_satisfaction, $interest, "; $connection = mysql_connect($hostname_Auth, $username_Auth, $password_Auth) or die ("Couldn't connect to server."); $db = mysql_select_db($database_Auth, $connection) or die ("Couldn't select database."); $today = date("Y-m-d"); $date=time(); $sql = "INSERT INTO survey (createDate, firstName, lastName, title, company, street, city, state, zip, telephone, email, annual_revenue, mailboxes, email_app, email_app_other, future_app, future_app_other, archiving, email_satisfaction, interest) VALUES ('$today', '$firstName', '$lastName', '$title', '$company', '$street', '$city', '$state', '$zip', '$telephone', '$email', '$annual_revenue', '$mailboxes', '$email_app', '$email_app_other', '$future_app', '$future_app_other', '$archiving', '$email_satisfaction', '$interest')"; echo "done"; session_destroy(); ?> Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2007 Share Posted December 11, 2007 You never actually execute the query. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 11, 2007 Share Posted December 11, 2007 How do you get DB errors when there is no query executed as Thorpe stated from above. Just in case your wodering, it goes a little something like this mysql_query($sql) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
tqla Posted December 11, 2007 Author Share Posted December 11, 2007 Ha ha. I knew it was something silly. 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.