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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:28:52+00:00 2026-05-26T05:28:52+00:00

I hopefully have a simple question I just cannot get anything I try to

  • 0

I hopefully have a simple question I just cannot get anything I try to work.

Basically I am looking for a way to simply count the yes’s in each column where user level = a number and by username = a user name in the past week starting on monday. Also for a way to total the amounts in the amounttot column.

My SQL Database is set up like below:

DB Name: 1_1 Table: form_2

Sample of data in DB

username userlevel inspect signatu claimnum amounttot timestamp
-------- --------- ------- ------- -------- --------- ---------
BobS     7         yes     yes     kj98739  5388.00   2011-10-15 16:39:20
SteveN   8         yes     no      kj76739  5000.00   2011-10-15 15:29:00
TimK     7         no      yes     kj98734  6000.00   2011-10-15 14:35:06

How I have it list all data per team, I just need to get totals below this print out in a completely different table I can just place below it., how can I get this to only show the last weeks data starting on a monday:

<?php
$con = mysql_connect("localhost","1_1","XXXXXXXXXXXXXXXX");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("1_1", $con);

$result = mysql_query("SELECT * FROM form_2 WHERE userlevel = '5' ORDER BY timestamp DESC");

echo "<table border='1'>
<tr>
<th><font size='1'>Name</th>
<th><font size='1'>Latitude</th>
<th><font size='1'>Longatude</th>
<th><font size='1'>Inspect</th>
<th><font size='1'>Sig</th>
<th><font size='1'>Phone #</th>
<th><font size='1'>Insur</th>
<th><font size='1'>Claim</th>
<th><font size='1'>Appr</th>
<th><font size='1'>AdjusApp</th>
<th><font size='1'>Check</th>
<th><font size='1'>Amount</th>
<th><font size='1'>Time</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td><font size='1'>" . $row['username'] . "</font></td>";
  echo "<td><font size='1'>" . $row['lat'] . "</font></td>";
  echo "<td><font size='1'>" . $row['longa'] . "</font></td>";
  echo "<td><font size='1'>" . $row['inspect'] . "</font></td>";
  echo "<td><font size='1'>" . $row['signatu'] . "</font></td>";
  echo "<td><font size='1'>" . $row['gotphone'] . "</font></td>";
  echo "<td><font size='1'>" . $row['hain'] . "</font></td>";
  echo "<td><font size='1'>" . $row['claimnum'] . "</font></td>";
  echo "<td><font size='1'>" . $row['approved'] . "</font></td>";
  echo "<td><font size='1'>" . $row['adjustapprov'] . "</font></td>";
  echo "<td><font size='1'>" . $row['checkcollec'] . "</font></td>";
  echo "<td><font size='1'>" . $row['amounttot'] . "</font></td>";
  echo "<td><font size='1'>" . $row['timestamp'] . "</font></td>";

  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?> 

Any help would be greatly appreciated. Thank you.

  • 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-26T05:28:53+00:00Added an answer on May 26, 2026 at 5:28 am

    Here is a suggestion:

    SELECT userlevel, COUNT(*)
    FROM form_2
    WHERE timestamp BETWEEN x AND y
    AND signatu = 'yes'
    GROUP BY userlevel
    

    The ‘x’ and ‘y’ need to be the timestamps delimiting the query – they can be supplied by PHP or looked up directly in MySQL.

    Edit: fixed query, thanks to @knittl.

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

Sidebar

Related Questions

Hopefully this is a simple question and I have just overlooked something somewhere... I
Simple question, hopefully an easy way and just want to verify I'm doing it
Hopefully have a simple question here but I cannot for the life of me
Hopefully very simple SQL question - I'm just blacking out :) I have a
Quick question, hopefully I am just missing something simple. Ok I have one class
Hopefully a simple question although one I have found impossible to answer myself using
This is a (hopefully) really simple question - I have been told recently that
This is hopefully a simple question: I have an OpenGL texture and would like
I have a simple question hopefully - how does one free memory which was
hopefully this is a simple question. I have a simple custom forum on my

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.