I can´t write in my database

QuestionsI can´t write in my database
RIcardo asked 11 years ago

Good afternoon again, I wrote the other day to see the questions I had and with firebug I got to see where was the error when writing or editing, but now i have other problem:

This is my query:

select_command = "SELECT * FROM ( SELECT ANALISTA.XUSUARIO, ANALISTA.NOMBRE , DEPARTAMENTO.NOMBRE_DEP , DEPARTAMENTO.FECHA_ALTA FROM ANALISTA ANALISTA
INNER JOIN REL_ANALISTA_DEPARTAMENTO REL_ANALISTA_DEPARTAMENTO ON ANALISTA.ID = REL_ANALISTA_DEPARTAMENTO.ANALISTA_ID
INNER JOIN DEPARTAMENTO DEPARTAMENTO ON REL_ANALISTA_DEPARTAMENTO.DEPARTAMENTO_ID = DEPARTAMENTO.ID) as O ";

When editing or writing for firebug I saw this:

Couldn't execute query. Unknown column 'PROYECTO' in 'field list' – UPDATE ANALISTA SET XUSUARIO='X2223',NOMBRE='Anas',PROYECTO='ASISKON2',FECHA_ALTA='2013-07-12 00:00:00' WHERE XUSUARIO = 'X2223'

Thank you very much for the help

4 Answers
Abu Ghufran answered 11 years ago

Hello,

It looks like this field is from a table other than you set in ($g->table) so, you need to use on_update event and write your own code for insertion along with other business level checks.

Free version only support update/insert/deletes on single table. You can select from multiples.
You need to have licensed version for custom events.

Lubos answered 11 years ago

Hallo,
I have a similar problem, but only when I write characters into the field "filter (search)" top of columns, and this column is not from same tables.
In this query it is only in fields hnazev,pnazev,vnazev, other fields is OK.

$ginf->select_command =
"SELECT i.id,i.id_ad,i.id_hw,h.nazev as hnazev,i.id_port,p.nazev as pnazev,i.ip_adresa,i.mac_adresa,
i.id_vlan,CONCAT(CAST(v.cislo AS CHAR),' : ', v.nazev) as vnazev,i.idn_info,i.zapujcka,i.pozn FROM info i
LEFT JOIN hw h ON i.id_hw = h.id
LEFT JOIN port p ON i.id_port = p.id
LEFT JOIN vlan v ON i.id_vlan = v.id";

I get error :
Couldn't execute query. Unknown column 'hnazev' in 'where clause' – SELECT count(*) as c FROM (SELECT i.id,i.id_ad,i.id_hw,h.nazev as hnazev,i.id_port,p.nazev as pnazev,i.ip_adresa,i.mac_adresa, i.id_vlan,CONCAT(CAST(v.cislo AS CHAR),' : ', v.nazev) as vnazev,i.idn_info,i.zapujcka,i.pozn FROM info i LEFT JOIN hw h ON i.id_hw = h.id LEFT JOIN port p ON i.id_port = p.id LEFT JOIN vlan v ON i.id_vlan = v.id WHERE id_ad = 90001 AND LOWER(hnazev) LIKE LOWER('%rb%')) table_count

Thank you very much for the help

Abu Ghufran answered 10 years ago

Hello,

Try using dbname for table.field and alias conflict.

$col["name"] = "hnazev";
$col["dbname"] = "h.nazev"; // WHERE clause will use this property instead of name.

Lubos answered 10 years ago

Thank you Abu, the search function works now well.
Thanks you.

Lubos

Your Answer

18 + 13 =

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?