Update an entire row in MySQL
mysql, php
Solution
To do that you need to
- Enumerate all the values
- Know the primary key column and value
So the final query would look like
UPDATE tablename
SET col1 = 'val1', col2 = 'val2' ...
WHERE id = id_value
There is no any magic command for updating the "whole row" in sql other than I shown above. And `REPLACE` is definitely not what you need here.
Problem
I'm new to MySQL and I want to update an entire row in MySQL with a new array, so far all the examples of the Update query involves specifying the column name and a new value for that column, like this: ``` "UPDATE tablename SET columnname = '".$new_value."' WHERE columnname = '".$value."'"; ``` How can I update an entire record with the update query or should I use the replace query? Any advice will be appreciated. Edit: Is there a query which doesn't require to specify all the column names and new column values? Basically I want to have a query that looks something like this: Update entirerow with thisarray where primarykeycolumn='thisvalue'