Skip to main content

I am trying to update a column value within my Monday.com table using the below code but I am getting the following error:


Variable $myvariable is used by but not declared


$query = 'mutation {
change_simple_column_value (board_id: [BOARD_ID], item_id: [ITEM_ID], column_id: "sold___deposit_paid", value: $myvariable) { id }
}';

It works if I put a value in place of the variable though. Why is this happening?

Hey @mcmaster1986 - welcome to the community!


You’ll want to declare the variable when sending the query over. It would look something like this:


$query = 'mutation ($myvariable: String!) {
change_simple_column_value (board_id: :BOARD_ID], item_id: :ITEM_ID], column_id: "sold___deposit_paid", value: $myvariable) { id }
}';

Let me know if that works!


-Daniel


Hi Daniel,


Please could you check my new thread and tell me what you make of this:


https://community.monday.com/t/change-column-value-with-php-variable/12587/4


@mcmaster1986 - looking into it, will chime in on that thread.