3
String sql = ("insert into registration(pic) values(?) where email='"+Email+"' ");

i get error :error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where email='yyy@ymail.com'' at line 1

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
rhsabbir
  • 247
  • 1
  • 6
  • 19

3 Answers3

1

Insert query format should be,

"insert into tablename (columnname) values(coulmnvalue)"

OR

"update registration set pic='' where email='"+Email+"'";
Krish R
  • 22,583
  • 7
  • 50
  • 59
1

You have to use UPDATE query to pass it like

String sql = "UPDATE registration SET pic = ? WHERE email = '" + Email + "'";

Syntax for UPDATE query is

UPDATE table_name SET column_name = value;
Naveen Kumar Alone
  • 7,536
  • 5
  • 36
  • 57
1

Yes. that is impossible.

Either you want:

insert into registration(pic) values(?)

Which will give you a new row;

Or you want an UPDATE:

UPDATE registration SET pic = ?
WHERE email = <EMAILYouWant>

Which will update an existing row where email = the record with the email you want to update the pic column.

Filipe Silva
  • 21,189
  • 5
  • 53
  • 68