Hello,
I have the table mb_relationships created, and if I try to make a query by sql, if I use the fields from or to I have a error:
If I use the field ID or the field type, the search is ok:
ok-> $resultado = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table WHERE type = 'opinion_to_atraccion'"));
ok-> $resultado = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table WHERE ID = '22'") );
But if in the query I use from or to, is a error..Maybe this two words have a conflict with the wordpress database?
Error-> $resultado = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table WHERE from = $ID"));
Error en la base de datos de WordPress: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from = 1635' at line 1]
Error-> $resultado = $wpdb->get_row($wpdb->prepare("SELECT to FROM $table WHERE from = $ID"));
Error en la base de datos de WordPress: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'to FROM w47fa_mb_relationships WHERE from = 1635' at line 1]
SELECT to FROM w47fa_mb_relationships WHERE from = 1635
Thanks,
Sergio