Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
158 views
in Q2A Core by
I try to make some modification for example when asking a question to add a new selectable field .... and I arrived to this strange query


        qa_db_query_sub($db,
            'INSERT INTO ^posts (type, parentid, userid, cookieid, title, content, tags, notify, created) VALUES ($, #, $, #, $, $, $, $, NOW())',
            $type, $parentid, $userid, $cookieid, $title, $content, $tagstring, $notify
        );


what $ and # mean...  

and where I need to add that field... in this query..  let say


        qa_db_query_sub($db,
            'INSERT INTO ^posts (type, parentid, userid, cookieid, title, content, MYFIELD, tags, notify, created) VALUES ($, #, $, #, $, $,  $, $, $, NOW())',
            $type, $parentid, $userid, $cookieid, $title, $content, $MYFIELD, $tagstring, $notify
        );

AND PAGE  qa_page_ask ?

1 Answer

0 votes
by
The $ and # symbols are substituted with the parameters that follow, in the same order. Use a $ for a definite string value (so that the parameter is put in quotes, even if it's numerical), and a # for other values (quotes only used if the parameter is a string).

So looking at your example, it looks like you've done fine.

Welcome to the Q&A site for Question2Answer.

If you have a question about Q2A, please ask here, in English.

To report a bug, please create a new issue on Github or ask a question here with the bug tag.

If you just want to try Q2A, please use the demo site.

Categories

...