Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
522 views
in Plugins by

I found a nice "workaround" that will help other plugin developers that need to parse the parameters (column params) from table qa_eventlog to an associative array:

$queryRecentEvents = mysql_query("SELECT datetime,ipaddress,handle,event,params
                                        FROM `qa_eventlog`
                                        WHERE datetime > NOW() - INTERVAL 8 HOUR
                                        ORDER BY datetime DESC
                                         ");
while($row = mysql_fetch_assoc($queryRecentEvents)) {

          
// convert tab jumps to & to be able to use query function
          $toURL = str_replace("\t","&",$row['params']);

          // parse as URL
          parse_str($toURL, $data);

          // access keys in array
          $postid = $data['postid'];

          // ... do what you like

}

1 Answer

+2 votes
by

            $params = array();
            $parameter = explode("\t",$event['params']);
            foreach($parameter as $param) {
                $parama = explode('=',$param);
                if(isset($parama[1]))
                    $params[$parama[0]]=$parama[1];
                else
                    $params[$param]=$param;
            }

from history plugin.

...