This topic is locked
[SOLVED]

 Record was not added

7/27/2011 8:29:16 AM
PHPRunner General questions
H
hsan author

I am sure I am having a very basic problem, but should someone have enough of patience with new comers, pls help.

I am trying to update a record in a table "Models', but I am using view with a single field from another table (master dependent drop box). That field is "id" from "Category" table. "Make_id" field from "Models" table is dependent on "Category_id". Everything works, but when I want to add new record, I got message "<<< Record was NOT added >>> Unknown column 'Category.id' in 'field list' ". I understand I cannot add records to multiple tables without custom query, but I am just adding record in a single table usng the field from another table for reference. Could someone pls explain to me how it works and what mistake I am making.
Thanks

H
hsan author 7/27/2011



http://www.asprunner.com/forums/topic/17424-unknown-column-fieldname-in-field-list/


But that is exactly what I have:
SELECT

models.id,

models.makeid,

models.name,

models.alias,

models.description,

models.published,

category.id AS id1

FROM models

, category
I am updating fields from "models" table and view is based on "models" table.

Sergey Kornilov admin 7/27/2011

You need to remove id1 field from the Add page (via 'Choose fields' screen). This way PHPRunner won't try to insert this field and your Add page will work.

H
hsan author 7/27/2011

Thanks for your input. The field id1 is dropdown (categories) that data entry depends on. What wold be the way then to make this work (dependent fields on a form)?
Thanks

H
hsan author 7/27/2011

Thanks for your input. The field id1 is dropdown (categories) that data entry depends on. What wold be the way then to make this work (dependent fields on a form)?
Thanks

H
hsan author 7/27/2011



Thanks for your input. The field id1 is dropdown (categories) that data entry depends on. What wold be the way then to make this work (dependent fields on a form)?
Thanks


Okay let me answer my own question. When you have foreign field in a table view and want to add records to that table (not to foreign field) then you need to add this in "before record added" event:
unset($values["your_foreign_field"]);
Is that correct?

C
cgphp 7/27/2011



Okay let me answer my own question. When you have foreign field in a table view and want to add records to that table (not to foreign field) then you need to add this in "before record added" event:
unset($values["your_foreign_field"]);
Is that correct?


That's right !

H
hsan author 7/28/2011



That's right !


Thanks cgphp
It works.