Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8404893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:43:02+00:00 2026-06-09T22:43:02+00:00

I am trying to track pageviews on my site whether a user is logged

  • 0

I am trying to track pageviews on my site whether a user is logged in or not and so I’m capturing the sessionId in my log. I only want to show tracking results for session ids that have at some point logged in and so my flow is as follows:

$pagestats = $wpdb->get_results("SELECT * FROM wp_user_stats WHERE uid=".$_GET['viewstats']);
$sessionArray = array();

foreach($pagestats as $checkSession)
{
    if( !(in_array($checkSession->sessionId, $sessionArray)))
    {
        $sessionArray[] = $checkSession->sessionId;
        }
    }

Next, I am trying to gather all of the stats concerning any session Ids generated by this particular user …

$sessions = join(',',$sessionArray);
$pagestats = $wpdb->get_results("SELECT * FROM wp_user_stats WHERE `sessionId` IN($sessions)") or die(mysql_error());

This is the part that throws the error. The error is:

Unknown column 'sjhntmqhltknks8pbhr750voe7' in 'where clause'

I don’t understand why it’s trying to find a column that matches the session Id instead of a result within that column.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:43:04+00:00Added an answer on June 9, 2026 at 10:43 pm

    The session IDs probably aren’t getting quoted so the query looks like WHERE sessionID IN(abc, def, ...).

    One way to fix that would be to change a line in the first loop:

    $sessionArray[] = "'".$checkSession->sessionId."'";

    Or you could create a second array with the quoted values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to track user login history for stat purposes but its not clear
I'm trying to track the page views by inserting only unique values every 24h.But
I'm trying to track down a NullReferenceException from a dump. The NullReferenceException is not
I am trying to track the number of users who did not allow my
I am trying to track mouse movements in the browser, and if a user
I'm trying to incorporate user statistics into a site and decided to go for
I am trying to track pageviews in MySQL DB using the following query: UPDATE
UA- * -1I'm trying to track file downloads on my site using GA Event
I'm trying to track a particular section of links on my page. I want
Trying to track down a bug in an application, but need to confirm whether

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.