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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:34:58+00:00 2026-06-13T05:34:58+00:00

I have a table with users and printed pages like this: user | pages

  • 0

I have a table with users and printed pages like this:

user  |  pages
---------------
maria |  5

helen |  6

maria |  7

nick  |  10

nick  |  3

nick  |  6

I want to count how many pages has printed nick, helen, maria.
I have tried some ways, but I don’t get the right number of pages.

Any ideas?


Till now i was saving the csv file in a specific folder with copy/paste, now i am trying to give the option to a user to upload it himself. Here are my html and a part of php files.

 <form action="data.php" method="post" enctype="multipart/form-data">
                <label for="file">   </label>
                <input  type="file" name="file" id="file" />
          </br></br>      <input type="submit" value="Load data file into database" 
            name="button1"/>
    </form>    

data.php

<?php
$file_name=$_FILES["file"]["name"];
$file_type=$_FILES["file"]["type"]; echo"type:".$file_type;
$destination="D:\xampp\mysql\data\readcsvdb";
if($file_type!='text/csv')
                        {
                                echo "Please the input file should be a .csv file";
                        }
else
move_upload_file($file_name,$destination);

connect_db(); 

//Fill the table log of readcsv database with the csv's data

$q="LOAD DATA 
                 INFILE '$file_name' INTO TABLE log 
                 FIELDS TERMINATED BY ',' 
                 LINES TERMINATED BY \"\n\" 
                 IGNORE 2 LINES
                 (time,user,pages,copies,
                 printer,doc_name,client,paper_size,language,height,width,duplex,grayscale,size)";
                mysql_query($q) or die(mysql_error());

——————— I am getting an error:
type:application/vnd.ms-excelPlease the input file should be a .csv fileFile ‘D:\xampp\mysql\data\readcsvdb\papercut-print-log-2012-10.csv’ not found (Errcode: 2)

  • 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-13T05:34:59+00:00Added an answer on June 13, 2026 at 5:34 am

    Try this

    SELECT user, SUM(pages) AS totalPages 
    FROM users 
    GROUP BY user
    

    SQLFiddle Demo

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

Sidebar

Related Questions

I have a table users with primary index userId . Currently, each user has
I have the table users and scores . Here are the associations: belongs_to :user
I have a table users which has a primary key userid and a datetime
I have users table and want to SELECT some rows by bitmask criteria. I'll
i have users table and i have posts table i want select from users
I want to have a database table that keeps data with revision history (like
I have many items and many users in a database. A user can set
I have table users with columns id, username, email and password. And i have
I have a table users. I wish to update the column email based on
I have a table [Users] with the following columns: INT SmallDateTime Bit Bit [UserId],

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.