Unable to update table – Invalid column name

QuestionsUnable to update table – Invalid column name
Steve asked 7 years ago

Hi, I have the paid version. I am trying to make updates to one table through a joined SQL statement, but I receive error messages when I try to make cell updates.

Could you please help?

Here is my SQL query:

$g->select_command = "SELECT O.ID, O.UPC, O.STYLE, O.COLOR, O.SIZE, O.DIMENSION, O.SEASON, O.GENDER, O.CATEGORY, O.WMS_INVENTORY, O.BC_INVENTORY, O.BLANK, O.WEBSITE, O.SAMPLE, O.NEIMAN, O.NOR16, O.NOR08, O.NEI04, O.NOR24, P.DIFF, P.BLANK AS NEW_BLANK, P.WEBSITE AS NEW_WEBSITE, P.SAMPLE AS NEW_SAMPLE, P.NEIMAN AS NEW_NEIMAN, P.NOR16 AS NEW_NOR16, P.NOR08 AS NEW_NOR08, P.NEI04 AS NEW_NEI04, P.NOR24 AS NEW_NOR24 FROM INVEN.ORIGINAL_INVENTORY O LEFT JOIN INVEN.PROCESSING_INVENTORY P ON O.UPC = P.UPC";

$g->table = "INVEN.PROCESSING_INVENTORY";

These are the errors it produces…

Couldn't execute query. [unixODBC][FreeTDS][SQL Server]Invalid column name 'ID'. – UPDATE INVEN.PROCESSING_INVENTORY SET BLANK='50' WHERE ID IN ('4')

PHP Warning: Invalid argument supplied for foreach() in /var/www/mysite/lib/inc/jqgrid_dist.php on line 5524

3 Answers
Abu Ghufran answered 7 years ago

Hello,

I'd recommend to connect on_update event handler and run your query manually.
As 2 tables are involved, it may be confusing for grid.

Refer http://www.phpgrid.org/docs/#Grid_Events

Steve B. answered 7 years ago

Thanks Abu! I read about the on_update event handler, but I'm not sure how to use it with my code.

Should I just add it like this?

$g->select_command = "SELECT O.ID, O.UPC, O.STYLE, O.COLOR, O.SIZE, O.DIMENSION, O.SEASON, O.GENDER, O.CATEGORY, O.WMS_INVENTORY, O.BC_INVENTORY, O.BLANK, O.WEBSITE, O.SAMPLE, O.NEIMAN, O.NOR16, O.NOR08, O.NEI04, O.NOR24, P.DIFF, P.BLANK AS NEW_BLANK, P.WEBSITE AS NEW_WEBSITE, P.SAMPLE AS NEW_SAMPLE, P.NEIMAN AS NEW_NEIMAN, P.NOR16 AS NEW_NOR16, P.NOR08 AS NEW_NOR08, P.NEI04 AS NEW_NEI04, P.NOR24 AS NEW_NOR24 FROM INVEN.ORIGINAL_INVENTORY O LEFT JOIN INVEN.PROCESSING_INVENTORY P ON O.UPC = P.UPC";

$g->table = "INVEN.PROCESSING_INVENTORY";

$e["on_update"] = array("update_INVEN.PROCESSING_INVENTORY", null, false);

// return last inserted id for further working
$e["on_after_update"] = array("after_update", null, true);

// invoked to filter data before displaying on grid
$e["on_data_display"] = array("filter_display", null, true);

Abu Ghufran answered 7 years ago

Please email me full code at [email protected]
I'll suggest the changes.

Your Answer

13 + 8 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?