473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Event csv list and pulling by date...

Just started "playing" with php and have a question. I currently have a csv
list such as this:

11-08-03 | Tournament | Chapman rules
12-18-03 | Beat The Pro | pick your partner
etc.

Is there a way by using the first field to pull one or all the events later
than the current date and, if so, returning a date say of Nov 8 and Dec 18?

Though I wanted to give the above a go, I figured out a way to pull the
correct events if I set the first field to 20031108, etc. Here is what I
got:

$readfile = file("events.txt");

for ($k=0; $k<=count($readfile)-1; $k++) {
$fields = split("|",$readfile[$k]);

$date = date("Ymd");

if ($fields[0] >= $date) {

print ("<tr><td>$fields[1]</td><td><a class=\"noUL\"
href=\"javascript:void(0);\"
onclick=\"window.open('$fields[0].htm','NextEvent','scrollbars=yes,resizable
=yes,height=600,width=650')\">$fields[2]</a></td><td>$fields[3]</td><td>$fie
lds[4]</td></tr>");

}
}

?>

The csv file for above would be
20031108 | Nov 8 | Chapman (Pinehurst)
but there has to be a better way. Thanks for any help

Bill
Jul 17 '05 #1
2 1893
"The Biscuit Eater" <Bo*****************@comcast.net> wrote in message news:<OMJnb.42045$ao4.99863@attbi_s51>...
Just started "playing" with php and have a question. I currently have a csv
list such as this:

11-08-03 | Tournament | Chapman rules
12-18-03 | Beat The Pro | pick your partner
etc.

Is there a way by using the first field to pull one or all the events later
than the current date and, if so, returning a date say of Nov 8 and Dec 18?


I'm curious to know the purpose. BTW, you can use fgetcsv
http://in.php.net/fgetcsv

If the dates are in ISO format, you can simple compare as strings.
ie, "2002-01-30" < "2003-12-30"

If you're searching for flat file DB, Google "TextDB"

---
"Our songs have meaning for everyone. I don't know of anyone who
isn't either in love, just out of love, or else wants to be in
love."--- Graham Russell, Air Supply
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2

"R. Rajesh Jeba Anbiah" <ng**********@rediffmail.com> wrote in message
news:ab**************************@posting.google.c om...
I'm curious to know the purpose. BTW, you can use fgetcsv
http://in.php.net/fgetcsv


Two things - listing the next golfing event on a web page and have a link to
all events after the current date. It is my first attempt writing in php so
the best I could do was to set $date = date(ymd) and then compare it to the
first field of a text file similar to:

20031108;Nov 8th;Beat the Pro

if fields[0] >= $date then display fields[1] and fields[2] with a link to
another file (say 20031108.htm) containing more information. The idea of
course is not to have to change the event each month since I know all the
dates for the next year.

This is what I came up with:
http://www.billhayes.us/mgagcai/indexReal.shtml

I saw the explode command and thought I could figure out a way to do the
same thing if I had something in the file like:

11-08-03;CHAPMAN (Pinehurst);pick partner;8:30 AM Shotgun
12-13-03;Beat the Pro;Individual play;tee choice;8:30 AM Shotgun
01-10-04;Twister;(Scramble-Stableford);Four man teams (white tees)

So ultimately I want to treat the first field as a date, compare it to the
current date and display the first or all records after today's date (and
display the month and day, like Nov 8)

Bill
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mark Nijhof | last post by:
Hi, A quicke summarize: I made a windows form that can set up a socket connection. It also has events that fire when data arives. Now I am using this form in a hidden way inside other code (was...
7
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
4
by: David Veeneman | last post by:
Do I need to unsubscribe from an object's event before I point the object variable to a new object? I have a method that subscribes an event handler to the ListChanged event of a list. The list...
1
by: xx75vulcan | last post by:
I have created an ASP page that will "on the fly" create an XML feed from my MS SQL database and the contents within a specified table. The Feed: http://www.rockwood.k12.mo.us/news/rss.asp You...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
3
by: assgar | last post by:
Hi I am having problem with my loping. I don't know if I have chosen the correct approach. GOAL: I need to insert into a table event types for a specific date range. The calendar the event...
3
by: Nepenthen | last post by:
Hello – I am still new to Access and I am currently working on debugging some code. I have a form with the following: Employee Name (combo with select all choice) Task (combo with select all...
3
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that...
2
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I'm pulling records from or database by dates, and there are multiple records for each part number. The part numbers are being stored as strings in a List in a custom Employee class: ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.