• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

send data to email

 
jil shi
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i face a problem here. for your information, i'm using jsp to handle my wen site. the problem is i have created list box in my web page. i am able successfully enter the data selected in database(mysql). the data that was inserted in database is code that represent the detail in the list box. for example, when i choose 'apartment' from list box, 'AP' will be inserted into database. i can do all these except how can i send the information to email. i know how to send email but when the recepient receive, they will get the code data. For example, they will get 'AP' instead of 'apartment'. how can i send the full word to email???
below is some part of my coding:<option selected="selected" value="done">--Select--</option>
<% String select_2 = "SELECT smd_cde2_typ, smd_cde2, smd_cde2_desc "+
"FROM smcde2 "+
"WHERE smd_cde2_typ = 'T' "+
"ORDER BY smd_cde2_desc ";
Statement stmt_2 = conn.createStatement();
ResultSet rset_2 = stmt_2.executeQuery(select_2);
while (rset_2.next()) {
property_code = rset_2.getString("smd_cde2");
property_desc = rset_2.getString("smd_cde2_desc");%>
<option value="<%=property_code%>"><%=property_desc%></option>
<% } %>
</select>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a JSP question so I'm shuffling this off to the JDBC forum.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34974
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jil,
Do you have a field in the database that contains the work instead of a code?
 
Prakash Anthony
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use a CASE expression to do this.
Following is an example:
SELECT EMPNO, LASTNAME,
CASE SUBSTR(WORKDEPT,1,1)
WHEN �A� THEN �Administration�
WHEN �B� THEN �Human Resources�
WHEN �C� THEN �Accounting�
WHEN �D� THEN �Design�
WHEN �E� THEN �Operations�
END
FROM EMPLOYEE;
 
Prakash Anthony
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But rather than hard coding these, I would go for joining the CODE column on to a table which has the descriptive names.
 
Prakash Anthony
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having said that, rather than hard coding these, I would go for joining the CODE column on to a table which has the descriptive names.
 
jil shi
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for your information, smd_cde2_typ refers to type. smd_cde2 refers to code and smd_cde2_desc refers to the description. For example, when i choose "apartment" in list bar, "AP" will be inserted database and apartment should send to email. "AP" refers to smd_cde2. secondly, "apartment" should send to email. "apartment" refers to smd_cde2_desc. now i can insert code and send code to email. what i need is insert code into database and send description to email. How can i solve my problem?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34974
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jil,
You need two queries. One to do the insert. And one (with the join) to select the full name for the e-mail.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic