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 4586862
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:41:56+00:00 2026-05-21T21:41:56+00:00

I am adapting some scripts that I found through Google that monitor users who

  • 0

I am adapting some scripts that I found through Google that monitor users who login in to a website.

This consists of including this in each page I want to monitor:

<?
include_once("config.php"); 
include_once("functions.php"); 
?>

config.php looks like this (I have removed info on actual database):

<?php 
      DEFINE ('DB_USER', '');// database username 
      DEFINE ('DB_PASSWORD', '');//database password 
      DEFINE ('DB_HOST', '');//database host, usually localhost 
      DEFINE ('DB_NAME', '');//and finally the database name 
      $dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error()); 
      @mysql_select_db (DB_NAME) OR die('Could not select the database: ' . mysql_error() ); 
?>

functions.php looks like this:

<?php 
$page = $_SERVER['PHP_SELF']; 
$user = $_SESSION["name"];
$logq = "INSERT INTO logs (Name, Page, Date) VALUES ('$user', '$page', NOW())"; 
$logr = @mysql_query($logq); 
?>

This works fine, i.e. the table in my database is populated correctly.

However the file that is supposed to generate a table on a webpage to show the information in the MySQL table isn’t working. The file, logs.php, looks like this:

<?php 
      $lq = "SELECT id, Name, Page, DATE_FORMAT(date, '%d %M, %Y') as sd FROM logs ORDER BY id DESC LIMIT 50"; 
      $lr = @mysql_query($lq); 

      if($lr){ 
      echo "<table><th>Name</th><th>Page</th><th>Date</th>"; 
      while($lf = mysql_fetch_array($lr, MYSQL_ASSOC)){ 
      echo "<tr><td>" . $lf['Name'] . "</td><td>" . $lf['Page'] . "</td><td>" . $lf['sd'] . "</td></tr>"; 
      } 
      echo "</table>"; 
      } 
      else 
      { 
      echo "No results!"; 
      } 
?>

Even though there is data in the MySQL table I am always getting just ‘No results!’ showing when I browse to the page.

Can anyone see what the problem is?

  • 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-05-21T21:41:56+00:00Added an answer on May 21, 2026 at 9:41 pm

    Perhaps you don’t have a db connection in logs.php? If your code is the full file then this should be the problem.
    If so, just include config.php at the top of the page.

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

Sidebar

Related Questions

I'm trying to customize an expandableListView by adapting some code I found. This invokes
So, I am adapting some code I found online to suit my needs. However,
I'm adapting some code that someone else wrote and need to return a DataTable
I'm borrowing/adapting this simple html/javascript form set up to put some data in the
I'm working on adapting a chained drop-down feature that I found online to my
I have this code that I am currently adapting to use nested entity (entity
I'm adapting this progress bar:http://www.richardshepherd.com/tv/audio/ to work with my playlist code, but I can't
I have been working through the tutorial adapting it to a project I want
I have the following jQuery which I need adapting: $(document).ready(function(){ $(.rss-popup a).hover(function() { $(this).next(em).stop(true,
I'm adapting a large number of SQL Server 2005 scripts to merge two of

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.