473,398 Members | 2,389 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,398 software developers and data experts.

Filter function help

Hi. I need help with a filtering function that I can't get to whatever
I try. I have this output that I need to filter:

<tr>
<td class="box_content" align="center">3,259</td>
<td class="box_content"><a
href="/user.php?id=3259">RandomName1</a></td>
<td class="box_content" align="center">4,239,298</td>
<td class="box_content" align="center">4,676</td>
<td class="box_content" align="center">94</td>
<td class="box_content" align="center"><img src="/online.gif"
alt="Online"></td>
</tr>
<tr>
<td class="box_content" align="center">3,260</td>
<td class="box_content"><a
href="/user.php?id=3260">RandomName2</a></td>
<td class="box_content" align="center">6,394,273</td>
<td class="box_content" align="center">5,762</td>
<td class="box_content" align="center">94</td>
<td class="box_content" align="center"><img src="/online.gif"
alt="Online"></td>
</tr>
<tr>
<td class="box_content" align="center">3,261</td>
<td class="box_content"><a
href="/user.php?id=3261">RandomName3</a></td>
<td class="box_content" align="center">8,422,858</td>
<td class="box_content" align="center">15,700</td>
<td class="box_content" align="center">94</td>
<td class="box_content" align="center"><img src="/online.gif"
alt="Online"></td>
</tr>

I need to extract only the rows that matches a value in the second
column bigger than 8,000,000 and the print only that rows. The given
example is just a random one. The actual file to process is bigger and
is changing everytime the filter function is called.

Can you help me out, please? I`ll mail you a beer! I promise :)

Thanks!

Jul 17 '05 #1
9 1743
NRGY,
I need to extract only the rows that matches a value in the second
column bigger than 8,000,000 and the print only that rows. The given
example is just a random one. The actual file to process is bigger and
is changing everytime the filter function is called.

You might want to define your question better.

ex. We have no clue what you mean by what the rows are and what you are
trying to filter and percisely what needs filtering.

Mike
Jul 17 '05 #2
Mike,

The rows are defined by <tr> and </tr> (so everything from a opening
<tr> to a closing </tr> is a row). A column is marked by <td> and
</td>. You should see the HTML marking.

Let me know if you feel me now.

Thank you.

Regards

Jul 17 '05 #3
In article <11**********************@z14g2000cwz.googlegroups .com>,
"NRGY" <nr**@acasa.ro> wrote:
Mike,

The rows are defined by <tr> and </tr> (so everything from a opening
<tr> to a closing </tr> is a row). A column is marked by <td> and
</td>. You should see the HTML marking.

Let me know if you feel me now.

Thank you.

Regards


You just reduced your chances of getting an answer here :o)

I think what he meant was that this is a php newsgroup, you've asked a
question about filtering which implies use of php or MySQL and you've
mentioned rows and columns which also alludes to MySQL. You then
present a big load of HTML.

Is this HTML being generated by PHP? Is the data in the table cells
taken from a MySQL table?

Can upload your php file with a phps extension and give us the URL?

--
Andy Jacobs
www.redcatmedia.net
Intelligent Websites For Intelligent Business People
Jul 17 '05 #4
Andy, I have posted here because here is the comp.lang.PHP group. And
what I need is a PHP filter function. So I don't see why you're picking
on the file to be filtered.

Jul 17 '05 #5
NRGY wrote:
Andy, I have posted here because here is the comp.lang.PHP group. And
what I need is a PHP filter function. So I don't see why you're picking
on the file to be filtered.


Sorry, I agree with Andy. I'm not sure what you're trying to do, either.

For instance - are you trying to read in the HTML you posted? Or are
you trying to generate output similar to the posted HTML, only with
different results? If so, whats the source?

Please be more clear with your question, and you'll get answers.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 17 '05 #6
> Andy, I have posted here because here is the comp.lang.PHP group. And
what I need is a PHP filter function. So I don't see why you're picking
on the file to be filtered.


What Andy said was exactly as I ment it.
For instance you have a data output normally from a database using php.
We have no clue as to how this data is generated, what you are using
it for, what the possible data types are, the list keeps going.

What you presented is this data talking about extracting data from rows
and columns. Are you processing just the html files from a webpage?
You most likely require regular expressions.

Mike
Jul 17 '05 #7
Guys, guys... That's the file that needs to be filtered for results
bigger than 8,000,000. Why you brought up databases and such? It is a
HTML page fetched by a socket connection. The output is similar to my
initial posting. Only that I don't want to output all of it - I want to
display only the values that exceed 8,000,000. In the case I gave as an
example the filtering function will grab only:
<tr>
<td class="box_content" align="center">3,261</td>
<td class="box_content"><a
href="/user.php?id=3261">RandomName3</a></td>
<td class="box_content" align="center">8,422,858</td>
<td class="box_content" align="center">15,700</td>
<td class="box_content" align="center">94</td>
<td class="box_content" align="center"><img src="/online.gif"
alt="Online"></td>
</tr>

So why all the fuss about databases and such when all I've asked help
for was a function to filter out the result and display accordingly?

Jul 17 '05 #8
NRGY wrote:
Guys, guys... That's the file that needs to be filtered for results
bigger than 8,000,000. Why you brought up databases and such? It is a
HTML page fetched by a socket connection. The output is similar to my
initial posting. Only that I don't want to output all of it - I want to
display only the values that exceed 8,000,000. In the case I gave as an
example the filtering function will grab only:
<tr>
<td class="box_content" align="center">3,261</td>
<td class="box_content"><a
href="/user.php?id=3261">RandomName3</a></td>
<td class="box_content" align="center">8,422,858</td>
<td class="box_content" align="center">15,700</td>
<td class="box_content" align="center">94</td>
<td class="box_content" align="center"><img src="/online.gif"
alt="Online"></td>
</tr>

So why all the fuss about databases and such when all I've asked help
for was a function to filter out the result and display accordingly?


If you would have been clear about that at the outset, there wouldn't
have been any confusion.

The reason for the "fuss about databases..." is that most pages like
this are generated by databases - and it's much easier to filter at the
database level than later.

Now that there's something concrete to work on, we can take a look.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 17 '05 #9
My thoughts:
<tr>
<td class="box_content" align="center">3,261</td>
<td class="box_content"><a
href="/user.php?id=3261">RandomName3</a></td>
<td class="box_content" align="center">8,422,858</td>
<td class="box_content" align="center">15,700</td>
<td class="box_content" align="center">94</td>
<td class="box_content" align="center"><img src="/online.gif"
alt="Online"></td>
</tr>


Write a regular expression. First that takes apart the <tr></tr> and
separates them into rows, one that separates the column data.

Then for each part of the column array check for a number exceeding
8,000,000, then if one is found keep that data, otherwise unset that
portion of the array.

When all filtering is done. Display the results by running through the
array.

Although I do not have a regular expression written for this, I would
suggest while writing it take a peak at http://www.regexplib.com
Mike
Jul 17 '05 #10

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

Similar topics

9
by: Robin Cull | last post by:
Imagine I have a dict looking something like this: myDict = {"key 1": , "key 2": , "key 3": , "key 4": } That is, a set of keys which have a variable length list of associated values after...
1
by: Lou | last post by:
I'm using the Response Filter Class in MS KB article 811162 (http://support.microsoft.com/default.aspx?scid=kb;EN-US;811162) to generate a static htm page from an asp.net template page being...
2
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the...
6
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a...
1
by: david.katkowski | last post by:
I'm trying to use the __builtin__ filter function within a class; however, I receive the following error: NameError: global name 'MajEthnic' is not defined The line of code is: EthMaj =...
1
by: kang jia | last post by:
hi i am quite confused between get() function and filter() function, what is the difference between. it seems they all retrieve the specific row from database. i have written this code in one...
4
by: Twayne | last post by:
Hi, I've been playing with ' if(!filter_var($email, FILTER_VALIDATE_EMAIL)) ' on my server and it seems to be working 100%. Pretty handy. Any ideas where I could find a summary of the e-mail...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
5
by: phill86 | last post by:
Hi, I have a form that I have applied a filter to by using combo boxes which works fine. Is there a way to apply that filter to the forms underlying query Here is the code that I use to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.