Jump to content

Mysql Query Help


DrTrans

Recommended Posts


$propid = $_POST['propid'];

$queryreg = mysql_query("UPDATE props SET
                         (`address`,`city`,`state`,`zip`,`active`,`lease`,`leaseamt`,`deposit`,`latefee`,`managementfee`,`background`, `uselatefee`) 
                         VALUES
                         ('$address','$city','$state','$zip','$active','$lease','$rent','$deposit','$latefee','$managementfee','$background','$usealatefee') WHERE propid = '$propid'"
                       ) or die(mysql_error());

 

 

wondering why this query does not work.

Link to comment
https://forums.phpfreaks.com/topic/264008-mysql-query-help/
Share on other sites

The following is the UPDATE query syntax definition, with the most common usage shown in red -

 

UPDATE [LOW_PRIORITY] [iGNORE] table_reference

    SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...

    [WHERE where_condition]

    [ORDER BY ...]

    [LIMIT row_count]

 

 

Link to comment
https://forums.phpfreaks.com/topic/264008-mysql-query-help/#findComment-1353154
Share on other sites

I understand that. but I'm updating multiple variables. Isn't there a much simpler way to do this.

 

Unfortunately not.

 

A good practice may be inserting the record with a different version by having version column.

 

if you are updating all the columns except id then actually you want to do a insert(assuming there are constraints in doing so ) and delete the old record.

Link to comment
https://forums.phpfreaks.com/topic/264008-mysql-query-help/#findComment-1353155
Share on other sites

Archived

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

×
×
  • Create New...

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.