Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Specify A Date Range And Have Only Entries That Are In That Date Range


I have this database with lots of info all time stamped with this format "May 15 2007  9:44AM".  What I would like to be able to specify a date range and have only entries that are in that date range be pulled from the table so that I can post the results. I know this must be possible but I have no idea host to even start.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
PHP Date Range?
Is there a way I can get PHP to echo a date range, and have it update weekly? I want it to show "Monthnow", "Datenow" - "Monththen", "Datethen" (Where Month/Datenow is the last recognized Wednesday, and Month/Datethen is the next upcoming Wednesday). Example, for the current week, the page displays: July 23 - July 30.

I'd like it to update that automatically on a weekly basis, if possible, using the date/time features of PHP. (I have no database).

View Replies !   View Related
Date Range
The >= statement below returns rows, but when I add the 2nd statement I get nothing. Is there a better syntax to use with MySQL 4? The <= doesn't work by itself either. Looks like <= can't be used at all.

AND CloseDateTime >= &#3908;/01/2007'
AND CloseDateTime <= &#3912;/31/2007'

View Replies !   View Related
Date Is Within A Range
Suppose i have 2 dates as range i.e: 10-03-2005 to 20-03-2005. Now i want to check if 15-03-2005 falls in the above range or not.

View Replies !   View Related
Submitting Date Range...
<?php
$query="SELECT SUM(hours) from log WHERE
pid='$'pid' AND uid = '$uid' AND
date >= '$start_date' AND date <= '$end_date'";
?>

Does this look right? I'm gonna create a form using genDateSelector(). Eg. to allow user to select a start date and end date to view summary report for that date range only. What am I missing?

View Replies !   View Related
Displaying A Date Range
I would like to display a user specified date range e.g Monday to Monday next week or maybe Monday next month. When I have the basic function worked out I would like to get Data from a Mysql Database. here is what I have thought about. Code:

View Replies !   View Related
Date Range Function
Is there any function i can use, somthing like date range, like all the dates between:
6/8/2001 "to" 12/8/2001 .

View Replies !   View Related
Selecting Date Range
How do I query a date range? I have a date column in my mysql table. I want to select a range of rows between : Ex. 2007-08-05 through 2007-08-30 .

I also would like to have the page that sends the query as a form.. option value that shows all of the available dates, so i can select a from date and a to date.

View Replies !   View Related
Selecting Within A Date Range
Basically I want to list all events that are active on a particular day. The events are saved in an SQL table with a start date and a duration. The following code appears to work but only returs one event when there should be 3! Code:

View Replies !   View Related
Query Date Range
I have a table which holds a bunch of dates

id   datefrom       dateto
1    2007-02-22   2007-03-05
2    2007-05-13   2007-06-23
3    2007-05-25   2007-07-23

the `datefrom` and `dateto` are dates in the format YYYY-MM-DD, the `datefrom` means the date the event starts and the `dateto` means the date the event ends.

What I want to run a query on this table and return any rows which have todays date between the 'datefrom' and the 'dateto'.

Does that make much sense?

View Replies !   View Related
Date Range Validation
I'm a sysadmin who just took over a php application and have no php training. I have this function: Code:

View Replies !   View Related
Selecting A Date Range
I have a similar problem where i have to display the records in a date range which will be selected by the user in two dropdown boxes picked up from the date field. The database contains numerous instances of similar dates for different managers and team leads.

The database contains fields :- Sr.No, Date,Manager,Team Lead, Attendance and calls taken. How can i populate the drop down with one instance of repeating dates in two drop downs so that the user can select the date range and data can be displayed to the user in a proper formatted row.

View Replies !   View Related
Date Range Display
I need to make this website. I want the PHP code to do the following...

On
05/21/06 - 05/23/06
echo "blah blah..1"
05/24/06 - 05/26/06
echo "blah blah..2"
05/27/06 - 05/30/06
echo "blah blah..3"

I started doing PHP today but I've done C before so it's not that far off. I know how to do it with a switch function but then I'd have to input every day
case "5/21/06":
case "5/22/06":

There are going to be A LOT of dates, and I'd prefer to keep them in daterange mode. but I have no idea how to do this.

View Replies !   View Related
Select Date Range
I have to run a query in mysql where records from a date range are selected. I need to know how to make the query of following type:

select * from datetest
where date between &#3911;-11-2001' AND &#3901;-10-2009'
order by date desc

It will be great if someone can tell me which is the best format for dates: Code:

View Replies !   View Related
How Many Sundays In A Date Range?
Dates come in the format 2006-02-16 (year-month-day) for example. I have this rather complicated proceedure using explode(), then mktime() that will give me the number of days in the date range, which could then be used in a loop that would step through the days.

Then I would need to go back from mktime format to XXXX-XX-XX format (not sure about that part yet), REEXPLODE the darn thing in order to use jddayofweek(gregoriantojd($mo, $day, $yr), 1) to get the day of the week that could be used in a counting loop.

I know this description is very general, but all of it does work (except for the format change I indicated I'm not sure how to do yet).

Just wondering if anybody knows of a more elegant solution. I'm not looking for "Here's the code", just more like "I know of this great little function or proceedure..." .

View Replies !   View Related
Date Range From Mysql
I am trying to make a select statement that will only get records from the current month. The dates are all stored in mysql in the standard format (yyyy-mm-dd), is there anyway to compare this field with a current month function.

View Replies !   View Related
Figure Out Date Range
What is the best way to figure out the date range of a week. I thought some like this

$day = -7;
$date = $currentdate - $day;

[sql]
Select $t_task,$tot_time FROM time WHERE username='$usrname' AND $t_date=<$new_date AND $t_date=>$current_date
[sql]

View Replies !   View Related
Date Range Query
how to make a php mysql query that would return only data inserted in the last 24 hours? I have a dateSubmitted datetime field in the database already.

View Replies !   View Related
Creating A Date Range Query?
If I have a date field, and want to select all records that are older then 30 days from today, is there a way to query MySQL for this? Code: $todaydate=date("Y-m-d");

$query = "SELECT * FROM members WHERE joined_date = '$todaydate-30' "; I know this will not work, but it's functionaly what I am trying to do.

View Replies !   View Related
Date Range Query Issue
I have a database which contains events, the structure has two date fields, one is called "datefrom" and the other one is called "dateto", these two fields contain dates in the format YYYY-MM-DD.

"datefrom" represents the start date and then "dateto" represents the end date.

I have a query which returns all rows which have todays date within the start and end date, but it doesnt seem to be doing this correctly all the time, if at all. Can anyone spot any issues I might have with it?

My query is

$eventssql = "SELECT * FROM events WHERE type = 2 AND datefrom BETWEEN CURDATE() AND CURDATE() + INTERVAL 6 DAY OR dateto BETWEEN CURDATE() AND CURDATE() + INTERVAL 6 DAY LIMIT 10";
$eventsquery = @mysql_query($eventssql,$connection) or die(mysql_error());
Make any sense?

View Replies !   View Related
Query Date Range Select
how do i make a query that select between today and a week from today.

View Replies !   View Related
Date Range In MYSQL Query
I'm trying to extract data in a certain range of date (say 1 month's worth), but my results aren't what I'm expecting.  Can you guys have a look at my code and suggest what may not be coded properly?

function display_archive($month) {
  $tempdate = $month. " 1, 2007";
  $startdate = date("F d, Y", strtotime($tempdate));

  $tempdate2 = $month. " 30, 2007";
  $enddate = date("F d, Y", strtotime($tempdate2));

  db_connect();
  $result = mysql_query("select * from blog where entered BETWEEN '$date' and '$enddate'");
  $num_rows = mysql_num_rows($result);
}

View Replies !   View Related
Query Based On Date Range?
I'm using php/mysql, and I want to write a query that will continually return results for records that fall within 7-day dates ranges. So, I want a query that will print out records for:

12/1/05 - 12/8/05
12/9/05 - 12/16/05
12/17/05 - 12/25/05

.... infinity

Can I accomplish this using a mysql query, or do I need to do something fancy with php, or both?

View Replies !   View Related
Allow User Specify The Search Date Range.
I am trying to write a query string that will allow user specify the search date range.
My records have a column with the "date" in the following format 0000-00-00. I can specify the FROM and TO range in the search form. Both FROM and TO have month and year.
Having difficulties with the actual query. PHP Code:

SELECT *
FROM mytable
WHERE tbl_date(MONTH) < ".$FROMmonth."
AND tbl_date(YEAR) < ".$FROMyear."
AND tbl_date(MONTH) > ".$TOmonth."
AND tbl_date(YEAR) < ".$TOyear."


Doesn't look right, does it?

View Replies !   View Related
Calculating A % Based On Date Range
I want to get the percentages for the 2 possiable values in TransResult and I want this done by date, so I can go backwards to compare what was done in the past months to what is done in current month. This is what i have come up with so far, however my _total is giving me ALL records in the table not this months records, so my percentages are off, aside from the total the values it is calculating are correct.

SELECT TransResult, COUNT(*) AS HowMany, (COUNT(*) / _total ) * 100 AS Percent FROM tbltranslog, (SELECT COUNT(*) AS _total FROM tbltranslog) AS myTotal WHERE MONTH(Date) = MONTH(NOW()) +0 GROUP BY transresult.

View Replies !   View Related
Code To Calculate Date Range In A Given Week
Well I'm facing a problem in calneder and want your
help. I want to calculate the date that fall in a give
week but am not able to get the method for doing so.

Let me explain it with an example. Suppose i select
teh 25th week of the present year(i.e 25th week of
year 2006) then how can i calculate the days that fall
in that week.

View Replies !   View Related
Script Which Randomly Picks Three Numbers Within A Certain Range And Shows Them At A Given Date & Time.
I have been looking for a script which randomly picks three numbers within a certain range and shows them at a given date & time. Until that, the site should show three numbers every five or ten seconds by automatic.

All visitors should get the same numbers and should not change even when refreshing the site. All visitors see the same numbers. New numbers are generated every five or ten seconds and are shown. Final and staying numbers are generated at a given time and date.

View Replies !   View Related
Help With Displaying Selecting A Date Range And Displaying Results
I wish to create a simple form that allows the selection of a start date and a stop date with the ability to select what columns to be displayed in the result page.

View Replies !   View Related
Date Dropdown From Mysql Date Entries
For the PHP gurus out there, here is what I want to do: create a dropdown list of available dates from a mysql database date entries. But the dropdown/s should have 3 separate fields in month, day and year which in effect shows only those months, days and years that have corresponding entries from the database.

Planning to use this in the archive section of an online news publication so people can select issues to view via dropdown list that have corresponding entries only.

View Replies !   View Related
Count Entries After Date
I've been using a script to count votes for pictures. Every time somene votes it records their ip and date they voted. It adds a new line to the table for every vote. (picNum is the picture they are voting for)PHP Code:

$query = "INSERT INTO kicks_voting (picture, ip, date) VALUES ('" . $_POST['picNum'] . "','" . $_SERVER['REMOTE_ADDR'] . "', '" . date('m.d.y') ."')";

Then when I want to see the total votes for a picture I use this script PHP Code:

$query = 'SELECT ip FROM kicks_voting WHERE picture ="' . $picNum . '"'   
$result = mysql_query($query);
mysql_num_rows($result);
echo mysql_num_rows($result);

What I need to do now is count only the votes that came in after a specific date. So I can show total votes, and then votes this month. I know there must be an easy way to do this.

View Replies !   View Related
Getting The Last Group Of Entries By Date
The part I'm having a brain fart over is how best to determine what's the freshest group of news entries from the db in the most efficient manner. I'm leaning towards using

GROUP BY TO_DAYS(pubdate)
ORDER BY pubdate DESC

which I believe will organize the entries by day of the pubdate in descending order but then I need to create a WHERE clause that will extract the latest group without knowing what the pubdate of the group is.

View Replies !   View Related
Using A Range In Php
Hi,

I am trying to create a online blood glucose level reader. I have created a page with the following text fields (which become variables on the following page).

name which becomes $name
glucose which becomes $glucose

View Replies !   View Related
Range Of Value
I have the following scenario.

Let say I have A1, A2, A3, B3, B4, B5, MC01, MC02, MC03

I also have the following value "A1-A3" ,"MC01-MC03", "B1-B4"

Let say I need to write a function to detemine A1 is belog to A1-A3, MC2 is belong to MC01-MC03, B4 is belog to "B1-B4". How could I accomplish this.

View Replies !   View Related
Range A-z + 0-9
i have a lyric page that sort artist from a-z each letter; however, i want to add 0-9 in front of a, b, c... example:

0-9 in 1 group

A

B

C
.
.
.
Z

i try to use this code, but the song title from 0-9 does not appear. Anybody know why? (again, i want my array to be like 0-9, A, B, C, D...Z). PHP Code:

foreach(array_merge(array(&#390;-9'),range('A','Z')) as $_letter)

View Replies !   View Related
Age Range
I have a field with user's date of birth. I would like to be able to show where the age fall into i.e.

25-30 years old

instead of

27 years old

I suppose I need to create an array with the ranges but not sure how to do the rest.

View Replies !   View Related
Ordering Range()
how to reverse the order in following script? PHP Code:

View Replies !   View Related
Dynamic IP Range
I do not know where posting it? Is there a way to find (and where to find it) the high end and low end of the USA dynamic IP range. I am not even sure that it is possible to get such an answer.

View Replies !   View Related
Range Of Dates
I'm trying to create a report in PHP/HTML showing all deliveries made from our database. I'd like to automatically generate a different report for each month of the year.

So I need to do two things: First I need to be able to find the earliest occurence of the date in the field called date_delivered in my SQL database - is there a particular function I should be using to achieve this?

And then secondly I need to automatically create a link to each month which will take the user to a page showing all deliveries that month?

View Replies !   View Related
Identifying A Value Range
i have a form that submits to a php file, the form basically has a hidden field called number:

<input type="hidden" name="number" value="12">

i know how to read the value of that, its simply putting <?php echo $_POST['number']?> but what i want to do is check if the number is between 1 and 25 and if it is then echo A else if it is between 25-75 then echo B else if it is anything above 75 then echo C .

View Replies !   View Related
Out Of Range Error
When I run this query on MySQL 5.0 server through PHP 4.3.10, I get an error.

mysql_query("INSERT INTO `tbl_graphics` VALUES('', '$height', '$width', '$format', '$details');") or die(mysql_error());

MySQL Error: Code:

View Replies !   View Related
IP From Private Range
Is it possible to get client's IP (private, you know 10.*.. 172.16.* 192.168.*...) not proxy or NAT address (using cookies maybe) ? I saw few pages that can do this but I'm not sure if they used PHP and/or something else so here's my wuestion. any ideas how ?

View Replies !   View Related
Preg_match() To Specify A Range
How can I use preg_match() to check if a number is between two values (specifically 2004 and $currentYear, which is equal to date(Y))? The pattern must be between 2004 and $currentYear, I want to return an error for any year out of that range, so I can't simply use [0-9]{4}. code;

if ( preg_match("/2004¦2005¦2006¦all/i", $_GET['year']) ) {
$year = strip_tags($_GET['year']);

} else {
die("Please enter a year in the form of four digits between 2004 and $currentYear, or enter 'all' to see all years.");
}

View Replies !   View Related
Fetch A Range
How would I go about generating a column of incrementing dates when provided a given start and end date/number of days? e.g.:

2006-05-07
2006-05-08
2006-05-09
2006-05-10
2006-05-11
2006-05-12
2006-05-13
2006-05-14
...

These dates should be in seperate rows. I know I could create a table and then have PHP automatically populate it, but I would like to know if there is a way that I could do this with just MySQL. I've done some searching, but have had trouble locating exactly what I need. Ultimately I'm going to use this table to peform a join against another table that has a date field, and I want a seperate copy of each row for every day that it coincides with.

View Replies !   View Related
Selecting A Range
How does one select a certain range of arrays without having to write them all out? I am wondering, how would one go about the following? So we have the following indexed arrays:

$array[0] = "A";
$array[1] = "B";
$array[2] = "C";
$array[3] = "D";

i'd like this fantasy if statement to work: if ($array[range 0-3] != A) print "blah blah blah"; elseif ($array[range 1-2] != A) print" do de do "; of course me putting the range inside the brakets is an absolute violation and won't work, how would i go about coding this properly?

View Replies !   View Related
How To Find IP Range
Is it possible using php to find the IP block that a partucular IP belongs in?

E.g. I can go to dnsstuff.org and type the IP address 209.126.158.167. This comes back with an IP range of

209.126.0.0 to 209.127.255.255 Is it possible to do this using PHP?

View Replies !   View Related
Getting Range Of Dates
I'd like to do a select on a range of dates. So for example I would like to select a week's worth of events. So for example I would like to select everything from 01/29/2006 to 02/05/2006 or something like that. My problem is for something like this how do I determine when the month changes and start over.

View Replies !   View Related
Using A Range Of Numbers
I'm trying to search for a wildcard within a variable. My question is how can i set the wildcard to be a range of numbers? e.g. my wildcard range of 19968 to 40891 should match the variable "&# 36544 ;"

View Replies !   View Related
Range Or Array?
i am trying to make a set of numbers from 0,1,2,3.... up to 100 into a variable so that i can check another variable is equal to 0 to 100

problem is i could easily use array (0 , 1 , 2 , etc but this is far to big a code and when i tried range it just put 100 into the variable.

View Replies !   View Related
MySQL Between A Range
PHP Code:

$result = mysqli_query($link,"SELECT * FROM pageref WEHRE pagerefno BETWEEN $leastinterestref AND $maxpageref");

View Replies !   View Related
Boolean Range
I want to check a variable to see if it is between a range but am not quite sure how to approach this for an if tree.

$a = 1;

if (0 < $a < 2) {
do whatever;
}

I tried "joining" but using two functions 0 < $a AND 2 < $a but that doesn't use 2 as a max and 0 as a min.

View Replies !   View Related
Viewing Range Of Results
is there any way to view a range of results in mysql, and by that i mean is there any way i can see the first 100 results of a query or the 50th through 100th results of a query.

is there any way to do that? i read about using views, but i didnt see anything about viewing a certain number of results. should i just feed my results into an array in php, and then sift through the array?


View Replies !   View Related
SELECT Rows Only Within A Certain Range
I want to find an easy way to select only rows within a certain range when I do a select. Im sure I have seen this done with a SELECT statement but cant remember if or how it was done. If not SELECT, whats the simplest way to do this? I have in the past
selected all rows, and using a counter and conditional statement I will only output if within range

//while shifting through the table select
if (($i 10) and ($i < 21))
{
//within range, output
}

Is this the simplest method?

View Replies !   View Related
Scanning IP And Port Range
I need to create a script that scans an IP range (and in turn a range of ports for each IP) and update a MySQL Database with all IPs:Ports that are found and respond to ping.

(It's mainly going to be pinging HL and HL2 game servers, but that is an un-necessary detail). I aim to have this script on a CRON Job type thing so it's run automatically at, say, 3AM each morning.

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved