• Resolved Pascal CESCATO

    (@pcescato)


    Hi! I’ve this shortcode:

    [cf7-recordset id="mydatas" type="database" query="SELECT id, description FROM {wpdb.prefix}mytable"]

    And it works as expected. But can I in some way add an URL parameter in query, like this:

    SELECT mt.id, mt.description FROM {wpdb.prefix}mytable mt WHERE mt.code = $_GET['code']
Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @pcescato

    Thank you very much for using our plugin.

    You can use two recordset fields. The first one reads the URL parameters, and fills a hidden field. The second one uses the hidden field value to get the database records.

    Some fields of the form structure would be:

    <input type="hidden" name="code">
    [cf7-recordset id="recordset_url" type="url-parameters"]
    [cf7-link-field recordset="recordset_url" field="code" value="code"]
    [cf7-recordset id="mydatas" type="database" query="SELECT id, description FROM {wpdb.prefix}mytable WHERE code={field.code}"]

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘URL params in SQL query’ is closed to new replies.