Remember: The WHERE is used to filter the records
The SET clause sets the value of a field
$query =âUPDATE Login SET User = â$userâ, userid = â$useridâ, address=â$addressâ, tel=â$telâ WHERE User = â$userââ, userid = â$useridâ, address=â$addressâ, tel=â$telâ";
This wouldnt work - the syntax is not right so you would need to fix that
$query =âUPDATE Login SET User = â$userâ, userid = â$useridâ, address=â$addressâ, tel=â$telâ WHERE User = â$searchuserâ AND userid = â$searchuseridâ AND address=â$searchaddressâ AND tel=â$searchtelââ;
Assuming you arenât using the same variables for the SET and the WHERE that will work. If you use the same variables like you have done in your query it wont give you any rows to modify
So basic overview
SELECT *, <column1>, <some more columns> FROM <Table> WHERE <any valid expression>
UPDATE <table> SET <column> = âvalueâ WHERE <any valid expression>
INSERT INTO <Table> (<list of columns>) VALUES (<list of values)
DELETE FROM <table> WHERE <any valid expression>
Examples:
SELECT column1, column2, column3 FROM table1 WHERE (column1 LIKE â%hello%â AND column2 = 3) OR column3 = -1
UPDATE table1 SET column1 = âhelloâ WHERE column2 = 1 OR column3 = 1
INSERT INTO table1 (column1, column2, column3) VALUES (âhelloâ, 50, -1)
DELETE FROM table1 WHERE column2 + 2 = 2 â (expression, add 2 to column2!)