Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.