2 users online. Create an account or sign in to join them.Users

Search

How do I use the output from the SymQL extension? What is the output? It looks like an XMLElelement Object.

I have added the following code to an event, to get the ID for the entry in question:

        if($_POST['fields']['name'] && $_POST['fields']['email-address'] && $_POST['fields']['un-subscribe'] == 'yes'){
            $query = new SymQLQuery();
            $query->select('system:id')->from('subscriptions')->where('email-address', $_POST['fields']['email-address'])->where('name', $_POST['fields']['name']);
            $res = SymQL::run($query);
            $entry = current($res);
            $_POST['fields']['id'] = $entry->id; // This doesn't work.
            $_POST['fields']['subscribed'] = 'no';
            unset($_POST['fields']['un-subscribe']);
        }

How do I get the ID for the entry returned?

By default it returns an XMLElement, so it can be a straight DS drop-in replacement. But you can get arrays and stuff too:

https://github.com/nickdunn/symql#run-the-query

RTFM :-)

Sorted. Thanks.

Sorted. Thanks.

Sorted twice! Now that is cool.

John, how did you use SymQL to get the value in the end? XML or a PHP array?

Sorry, got it! $res['section']['entries'][$_POST[id]] etc... :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details