• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to handle MYSQL

 
skevin scott
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to update a database with inserting form inputs?
I try this code,

<sql:update dataSource="${snapshot}" var="result">
INSERT INTO Student VALUES ('$_GET[firstname]','$_GET[lastname]','$_GET[age]');
</sql:update>

but its not work.
can anyone help me?
 
Rob Spoor
Sheriff
Posts: 20837
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ItDoesntWorkIsUseless. What does it do instead? Do you get an error?
 
Nam Ha Minh
Ranch Hand
Posts: 512
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code inside the <sql:update> tag is not really Java, as I see something like:

$_GET[firstname]

it looks like PHP code.
 
skevin scott
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok. but how get the value of text box for database?

 
Nam Ha Minh
Ranch Hand
Posts: 512
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
skevin scott wrote:ok. but how get the value of text box for database?



You can use EL expression, for example:

 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!