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,040,783
  • 362
  • 3,548
  • 3,513
rhsabbir
  • 237
  • 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,188
  • 7
  • 49
  • 57
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,360
  • 5
  • 34
  • 53
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
  • 20,688
  • 4
  • 50
  • 67