Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PG4WP is wrongly wrappling the SQL statement in the visitor maps plugin

Posted on 2014-02-02
1
Medium Priority
?
499 Views
Last Modified: 2014-02-04
I have wordpress 3.8.1 with postgres, I have modified the php in visitors-maps.php for the create table part however for the rest of the queries (insert and update) the query is sent to the database with an additional keyword at the end, for example
The query in the visitors-maps.php looks:

        $query = "INSERT INTO " . $wo_table_wo . "
        (session_id,
        ip_address,
        user_id,
        name,
        country_name,
        country_code,
        city_name,
        state_name,
        state_code,
        latitude,
        longitude,
        last_page_url,
        http_referer,
        user_agent,
        hostname,
        time_entry,
        time_last_click,
        num_visits)
        values (
                '" . esc_sql($ip_address) . "',
                '" . esc_sql($ip_address) . "',
                '" . esc_sql($wo_user_id) . "',
                '" . esc_sql($name) . "',
                '" . esc_sql($country_name) . "',
                '" . esc_sql($country_code) . "',
                '" . esc_sql($city_name) . "',
                '" . esc_sql($state_name) . "',
                '" . esc_sql($state_code) . "',
                '" . esc_sql($latitude) . "',
                '" . esc_sql($longitude) . "',
                '" . esc_sql($last_page_url) . "',
                '" . esc_sql($http_referer) . "',
                '" . esc_sql($user_agent) . "',
                '" . esc_sql($hostname) . "',
                '" . esc_sql($current_time) . "',
                '" . esc_sql($current_time) . "',
                '1');";

Open in new window


But in the postgres log I can see it sent to the DB as:
STATEMENT:  INSERT INTO wp_visitor_maps_wo
               (session_id,
               ip_address,
               user_id,
               name,
               country_name,
               country_code,
               city_name,
               state_name,
               state_code,
               latitude,
               longitude,
               last_page_url,
               http_referer,
               user_agent,
               hostname,
               time_entry,
               time_last_click,
               num_visits)
               values (
                       '0.0.0.0',
                       '0.0.0.0',
                       '1',
                       'Me',
                       'Home',
                       'HO',
                       'CITY',
                       'AREA',
                       '00',
                       '0000',
                       '0000',
                       '/wp-admin/?loggedout=true',
                       'http://www.mydomain.com',
                       'Client',
                       'ISP',
                       '000',
                       '000',
                       '1'); VALUES

Open in new window


It has added the word VALUES at the end.

Also Query is in the visitors-maps.php looks:

 $wpdb->query("UPDATE " . $wo_table_st . "
  SET
  count = '" . absint($visitors_count) . "',
  time = '".$mysql_now."'
  WHERE (time !='".$mysql_now."' 
     OR count < '" . absint($visitors_count) . "') AND type = 'day';");

Open in new window


But in the postgres log I can see it sent to the DB as:

STATEMENT:  UPDATE wp_visitor_maps_st
         SET
         count = '0',
         time = '2014-02-02 12:47:50'
         WHERE (time !='2014-02-02 12:47:50'
            OR count < '0') AND type = 'day'; SET

Open in new window

It has added the word SET at the end.

Is there a way to correct this issue?
0
Comment
Question by:Ashraf Hassanein
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Ashraf Hassanein earned 0 total points
ID: 39832292
PG4WP is not working properly if values is written in lower case and for the update all the command has to be written in one line.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
The viewer will learn how to dynamically set the form action using jQuery.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question