Jenksuy Posted June 16, 2013 Share Posted June 16, 2013 (edited) I don't understand why my database will not connect to my server... Can anyone see anything that I cant? <?php // Grab our POSTed form values // Note that whatever is enclosed by $_POST[""] matches the form input elements $reference = $_POST["reference"]; $category = $_POST["category"]; $title = $_POST["title"]; $location = $_POST["location"]; $salary = $_POST["salary"]; $type = $_POST["type"]; // Connect to our DB with mysql_connect(<server>, <username>, <password>) $sql_connection = mysql_connect("xxxx", "xxxx", "xxxxx"); if (!$sql_connection) { echo "Please try later."; } else { mysql_select_db("frcrecru_beta", $sql_connection); } // Probably should check to make sure the connection was successful // But I'm too lazy... $sql = "INSERT INTO face-recruiter ( reference, category, title, location, salary, type ) VALUES ( '$reference', '$category', '$title', '$location', '$salary', '$type', NOW() )"; mysql_query($sql, $sql_connection); mysql_close($sql_connection); ?> Thanks Edited June 16, 2013 by ignace Removed db credentials, though you should still change your password Quote Link to comment Share on other sites More sharing options...
trq Posted June 16, 2013 Share Posted June 16, 2013 Can you ping the ip? By the way, it's probably not the best idea to post your username and password on a public forum. You'd best change your password now. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 16, 2013 Share Posted June 16, 2013 Are you in fact getting the error message "please try later"?? Cause if you are not, then how do you know you didn't? Plus you should add MySQL_error() to that echo statement to help you out. BTW - your insert has more values than field names. 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.