swi prolog mysql + web

穿精又带淫゛_ 提交于 2019-12-04 16:11:19

Note that main_page//0 is a non-terminal, not a predicate. To call your database predicates from the main_page//0, you need to write something like:

main_page -->
   {create_db_connect,
   use_database,
   query_to_database(X),
   disconnect_database},
   html(div('id="tab_c2"', p('~w')-[X])).

The {}/1 construct allows you to call predicates from (the body of) grammar rules. Without it, create_db_connect and the others would be interpreted as calls to other non-terminals (create_db_connect//0, ...).

Typically, non-terminals are expanded into predicates by appending two arguments. Hence the warnings you got:

Warning: create_db_connect/2, which is referenced by
Warning: /root/prologDev/el.pl:56:17: 1-st clause of main_page/2
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!