Jump to content

Archived

This topic is now archived and is closed to further replies.

koolaidman52

update a lot of colums at once

Recommended Posts

i want to update an entire row of data in a DB heres what I'm trying in a nutshell

$que = "UPDATE series SET (first_name, last_name, age) = ('$_POST[firstname]','$_POST[lastname]','$_POST[age]') WHERE name = '$name'";
mysql_query("$que", $connection) or die('Error, query failed');

It dies, is my syntax right?

Share this post


Link to post
Share on other sites
The SQL Syntax is:
[b]UPDATE table SET row_name='value' WHERE condition='value'[/b]

Your query is:
[code]
$que = "UPDATE series SET first_name='{$_POST['firstname']}', last_name='{$_POST['lastname']}', age = $_POST['age'] WHERE name = '$name'";
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.