both answered helped out a lot.
I have a question though how did you know to divide by 4 and multiply by 4?
Alex
User Profile
Collapse
-
Quaterly rounding in PHP
I had post a thread on rounding before, but it really wasnt what I needed. I need quaterly rounding I have tried this
$FormatFinalTot al = (ceil($FinalTot al*20))/20;
and that rounds 67.67 to 67.70 or 23.23 to 23.25
what i need is 60.10 to 60.25 or 67.67 to 67.75
or 67.80 to 68.00
Any help would greatly be appreciated.
Thanks, ... -
Yea, I saw that in the maually and I tried using it and it didnt work, hsriat's solution does work great though. Thank you very much.
Alex...Leave a comment:
-
Rounding in php
I read the Manuel on php.net for rounding but none of it really applied to me.
What I am trying to do is round the number 4.23 to 4.25 or 65.76 to 65.80 or 9.98 to 10.00
Any help would be greatly appreciated.
Thanks in advance,
Alex -
Thanks, that worked I just had to change > 1 to > 0 zero, because if I submitted a the time sheet and then hit the back button for some reason it would reenter the time even though it was already there. But changing it to zero fixed the problem.
Thanks for your help.Leave a comment:
-
MySQL and PHP check for already submitted data
I've been creating this webapp and for some weird reason I cant get this part to work. What I'm trying to do is check for a match on the username and startdate. If there is a match then that user has already submitted his/her timesheet.
...Code:$check = mysql_query("SELECT * FROM timesheets WHERE username = '$username' AND startdate='$start_date'"); if($check != 0) { die("<p>Sorry, -
Sorry about that I was not trying to make you write my whole program there was just some parts I was confused about. I think I figured it out though. I actually ended up using the datetime module and using a for loop to count how many user were in the target time. I got a few errors because I was trying to use a list in the time function that you gave me.
Thanks, for all your help again I really appreciate. I just started to learn...Leave a comment:
-
I get this output when I run it.
"""
None
True
Out of range
User logged in during the target time.
"""
What I want it to do is to be able to interpret the whole text file not just d1, and d2. And I also want to to display how many users logged in during that target time. I think I could do that with just a for loop.
I hope that helps clarify...Leave a comment:
-
I got another output printed out None. Do you know where that comes from?
Also, how can I make that work for my whole txt file?Leave a comment:
-
I added how many users logged in that day now I want to narrow it down to how many users are logging in every three hours. So I did how many logged in for that day by doing what's below. And I was able to do it this way because the log file is only for a day.
But I have having trouble...Code:count = 0 for key in logdict: count += 1 print '%s users logged in today' % (count)Leave a comment:
-
Linux is the way to go for web development. I use zend studio for my php projects along with a MySQL database. And the only thing I really use adode for is photoshop....Leave a comment:
-
I actually down something very similar. Except I wanted to display the top three uses. So, I reversed the sort and sliced the list. Below is my code.
...Code:freqList = [[len(logdict[key]), key] for key in logdict] freqList.sort(reverse=True) print freqList # print 'The user that logged in the most times is %s.' % (freqList[-2][1]) print 'The user that logged in the most times is %s.' %
Leave a comment:
-
Okay, I see what you're doing but I have a few questions. What does logdict={} exactly do. Baiscally this code block of code that you wrote
I'm a little bit confused.Code:for item in fileList: m = pattLog.search(item) if m: logdict.setdefault(m.group(1), []).append(m.group(2))
Also, I if I wanted to find the most reoccurring user would I add a counter to that for...Leave a comment:
-
How to do a report on a .txt log file
I have a .txt log file and must of it is crap. But there are parts that display when a user logs in, and at what time the logged in. Below is a portion of the log file. For example, "mwoelk" is a user logging in and "dcurtin" is another user logging in. So far I have created a python app that counts how many times a user logged in, but I'm a little clueless on how to pull when the user logged in. Any help on what I could do would... -
-
-
Works in firefox but not internet explorer
This code works in firefox perfectly, but in Internet Explorer it does not calculate the total correctly. Anybody know why?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>Order form</title>
<style type="text/css">... -
Trying to create a running total with radio buttons
Hey All,
So, I have a product that cost 1050.00 dollars by itself. With radio buttons I want the user to be able to add extra features to it or take away certain features from it. Which would increase or decrease the total price. While they are doing that I want the total price showing. Here is what it looks like so far so you could get a better idea.
www.mediaprosusa.com/syops_config.html...
No activity results to display
Show More
Leave a comment: