Jump to content
xisto Community
brandonjbegle

Form To Mysql Database Help

Recommended Posts

Can someone tell me how to send data from a form to an sql database.the inputs arelink_urllink_namelink_descriptionIf you can write what this should look like, including the html form, it would really be appreciated

Share this post


Link to post
Share on other sites

Open the Database Connection and Select the database you wish to use

// Make the connnection.$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );// Select the database.@mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
Assume the Form has been POSTed, validate the POST values into regular variables and the INSERT them into the database.
// Make the query.$query = "INSERT INTO users (first_name, last_name, email, password, registration_date) VALUES ('$fn', '$ln', '$e', SHA('$p'), NOW() )";
Now Close the database
mysql_close(); // Close the database connection.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.