How to insert data into a db

Reply

Join Date: Dec 2006
Posts: 4
Reputation: LoobyLou is an unknown quantity at this point 
Solved Threads: 0
LoobyLou LoobyLou is offline Offline
Newbie Poster

How to insert data into a db

 
0
  #1
Dec 20th, 2006
Hi
Does anyone know how to insert data into a database from a website?
I have created a Registration form for users to register to my web site. With this I would like the data they have entered to be stored in a MySQL database. I have created the a form and used the record insertion form wizard. When I inserted a form, I enetered a name and the method was POST, but it also needed an action. How do I write in java that it needs to be inserted into the database?
But when I press on the submit button, it goes to a page saying the website declined to show this page. The most likely cause is the website requires you to log in.
What am I doing wrong?
The database is set up correctly, however the log in information is not storing but I want them to register first then log in every time they come to the site.
If anyone could help, it would be greatly appreciated,
thanks Lou.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to insert data into a db

 
0
  #2
Dec 20th, 2006
Your data won't magically make it to the database just because it's there.
You'll need to write code to put it into the database.
There are many ways to do this, but as a beginner you should start out learning the basics and that's JDBC.

There are quite a few tutorials about it, and many good books have a section dedicated to it (of course there are also dedicated books specially for JDBC).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 4
Reputation: LoobyLou is an unknown quantity at this point 
Solved Threads: 0
LoobyLou LoobyLou is offline Offline
Newbie Poster

Re: How to insert data into a db

 
0
  #3
Dec 20th, 2006
Would I insert the following statement:-
String insert = "INSERT INTO people(firstname, lastname, email, password) VALUES(?,?,?,?)";But where should it go, so it would insert data into the database when I clicked on the submit button?Thanks Lou
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: How to insert data into a db

 
0
  #4
Dec 21st, 2006
you'd supply that to a PreparedStatement which is executed on a Connection.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC