Array Error

//25 <input type=text name=prod>

String[] prod_detail=req.getParameterValues("prod");

if (prod_detail != null){

for (i=0;i<prod_detail.length;i++){

prod_detail=prod_detail;

}

}

for(i=0;i<prod_detail.length;i++){

stm.executeUpdate("insert into product(co_id,pro_name) values((select co_id from company where co_email='"+email+"'),'"+prod_detail+"')");

}

Problem:

If the user inserted into 3 input texts then it inserts into DB but also insert 22 blank text inputs into DB

plz check it and let me know the solution>

[647 byte] By [ZafarAliKhana] at [2007-10-3 5:09:47]
# 1
Please try again and this time use code formatting tags (select all the code you are posting and click the code button right above the text box).Your code is unreadable due to lack of code tags.
cotton.ma at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

//25 <input type=text name=prod>

String[] prod_detail=req.getParameterValues("prod");

if (prod_detail != null){

for (i=0;i<prod_detail.length;i++){

prod_detail=prod_detail;

}

}

for(i=0;i<prod_detail.length;i++){

stm.executeUpdate("insert into product(co_id,pro_name) values((select co_id from company where co_email='"+email+"'),'"+prod_detail+"')");

}

Problem:

If the user inserted into 3 input texts then it inserts into DB but also insert 22 blank text inputs into DB

plz check it and let me know the solution>

ZafarAliKhana at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
No!What you did here was copy and paste your mangled code again without code tags. This is not your code. Post YOUR ORIGINAL CODE with CODE TAGS.Jeebus.
cotton.ma at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

//25 <input type=text name=prod>

String[] prod_detail=req.getParameterValues("prod");

if (prod_detail != null){

for (i=0;i<prod_detail.length;i++){

prod_detail=prod_detail;

}

}

for(i=0;i<prod_detail.length;i++){

stm.executeUpdate("insert into product(co_id,pro_name) values((select co_id from company where co_email='"+email+"'),'"+prod_detail+"')");

}

Problem:

If the user inserted into 3 input texts then it inserts into DB but also insert 22 blank text inputs into DB

plz check it and let me know the solution>

ZafarAliKhana at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5

please also check the DB insertion Command

for(i=0;i<prod_detail.length;i++){

stm.executeUpdate("insert into product(co_id,pro_name) values((select co_id from company where

co_email='"+email+"'),'"+prod_detail[i]+"')");

}

>

ZafarAliKhana at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6

You're an idiot and I give up.

I know your ORIGINAL CODE has something like this for example

prod_detail[i] =

Because I can see where it went wonky without the code tags. I am really not interested, and I doubt anyone else will be either, in trying to reconstruct your code and put all the missing bits back.

cotton.ma at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 7

> You're an idiot and I give up.

[b]

this is the 5th time that am posting and you didn't understand. now let me tell who is an idiot? Certainly you

and its better to not reply anybody and surely you have to give up

[/b]

> I know your ORIGINAL CODE has something like this for

> example [code]prod_detail =

You don't know anything Mr. Nothing

> Because I can see where it went wonky without the

> code tags. I am really not interested, and I doubt

> anyone else will be either, in trying to reconstruct

> your code and put all the missing bits back.

even I putted the code tag but you can never undertand that whats missing

ZafarAliKhana at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 8
You are an idiot. You keep posting code that you copy and paste from your first post that has the code mangled.It is too late to shove that into code tags.Please try and be less stupid.
cotton.ma at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 9

Now rather than continuing to prove your ignorance might you please

consider posting your source code from your file (NOT THE CODE

POSTED IN YOUR FIRST POST) and use the code tags.

Then someone might be able to help you.

I cannot make it any clearer than this. You have till this point still not

posted your actual code.

cotton.ma at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 10

> for (i=0;i<prod_detail.length;i++){

> prod_detail=prod_detail;

> }

> }

What are you trying to achieve with this code ?

Now it just assigns prod_detail to itself, it's useless.

> plz check it and let me know the solution

Use some debugger to find out what's wrong. Check the lenght of you'r array and how many times you execute that insert statement. Thus you will learn to solve problems yourself.

Maris_Orbidansa at 2007-7-14 23:16:04 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...