rlink with foreign key not working
-
Hi and thanx for the great plugin.
on the same page 3 [abase] : 1 for the result, one for the search and one for the update
[abase table=”pb_media” elements=”id,Media^nom_media,Editeur^id_editeur|nom_editeur” where=”AND status=’1′”echo=”0″ left=”*” rlink=”nom_media” ack=”green” limit=”5″]
[abase form=”1,search” table=”pb_media” columns=”nom_media=%nom_media%$Recherche Media” elements=”nom_media” ack=”green” center=”*” ]
[abase form=”1,update” table=”pb_media” elements=”Media^nom_media!’width:150px’,Editeur^id_editeur!’width:150px’$Update” left=”*” ack=”brown” echo=”0″]
When I click on the link generated by rlink, there is a fatal error:
#1. [abase table=”pb_media” elements=”id,Media^nom_media,Editeur^id_editeur|nom_editeur” limit=”5″ left=”*” rlink=”nom_media” ack=”green”]
Fatal Error (1432)
Column ‘id’ in where clause is ambiguous
SELECT * FROM pb_media LEFT JOINpb_editeurASpb_media$id_editeur$pb_editeurONpb_media.id_editeur=pb_media$id_editeur$pb_editeur.id WHEREid=’1′ LIMIT 5 table_error = ” cols_in = ” fields_in = ” columns_in = ‘*’ form = ”The sql code generated by [abase] is not correct. The right code is WHERE pb_media.
id = 1instead of WHEREid= ‘1’
I’ve tested with table name before and it works inside a mysql query.The 3 [abase] shortcodes work perfectly with a table with no foreign keys because there is only one table and of course no ambiguity 🙂
Where in the abase.php can I add the current table variable to generate the right mysql query ? (but it would be better to add it in the release)
Note: the current table name before the fields in WHERE clause can be universal to every queries.(even on single table queries)Thanks
Stephane
The topic ‘rlink with foreign key not working’ is closed to new replies.