RE: [PHP] PHP OOP

2003-10-01 Thread Daniel Purdy
[snip]I'm working for the first time with object orientated programming
in php and I can't figure out how to access elements or methods when you
place objects inside objects inside other objects.

my origonal idea was to  use the following syntax:
$a->b->c
but this just returns:
$a->b  . "->c"

Please, need advice on the finer points of OOP in PHP
[/snip]

Here is a link to an article that helped get me started on oop in php
http://www.phpbuilder.com/columns/luis2420.php3

Daniel

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] date question

2003-11-19 Thread Daniel Purdy



Hello all,

I would like to create a php function as follows:

function get_next_dates($ndays) {
   /*
  1. get the current date
  2. create an array say $results
  3. Store the dates for the next $ndays in $results
   */

   return $results
}


So in my main program I can include the file with the function and use 
it as follows:



$next_4_days[0] -> 11/20
$next_4_days[1] -> 11/21
$next_4_days[2] -> 11/22
$next_4_days[3] -> 11/23

if today was 11/19

Is there an easy way to do this?

Can I somehow use something like getdate+7 say to get 7 days ahead?

many thanks,

Ahbaid


Try www.php.net/date

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] date conversion

2003-12-10 Thread Daniel Purdy

Hi, is there a PHP function that will convert MM/DD/ to MMDD? 

Also I will need to take into affect some people may put in M/D/
(some 
people may put in 1 instead of 01, 2 instead of 02, etc).  Is there a
way 
to do this?


take a look at these functions

http://www.php.net/mktime 
http://www.php.net/strtotime 
http://www.php.net/date 
http://www.php.net/time 

they should put you on your way

In addition to Matt's links I'd also suggest http://www.php.net/explode
This can be used to help re arrange the dates (MM/DD/ to MMDD)
with some ease, just explode on the / and then concat the explode arrays
together in the order you want and save that to a variable. HTH!
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Bad characters in a text field

2003-12-12 Thread Daniel Purdy

 
For example: I want to allow a-z ,A-Z, 0-9 and some others and strip out
everything else.


You probably just want to use a regular expression. Check out
http://www.php.net/ereg
HTH! 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Number validation again...

2004-07-30 Thread Daniel Purdy

[snip]
Does exits any function in PHP to see if one string is compose for
numbers. And I have already searched in google before I asked here 
[/snip]

The manual is your friend.
http://www.php.net/strspn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] reading from files

2004-09-17 Thread Daniel Purdy
[snip]

I am wondering how to read lines from a file to a php array? I would
like to 
integrate a logfile into a html site. Is it possible to read line by
line and to 
check how many lines there are in total?

Thank you for any hint on that,
[/snip]

http://www.php.net/fgets is a good starting point.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] ASP guts needs help.

2004-09-22 Thread Daniel Purdy

[snip]

On Wed, 22 Sep 2004 00:09:01 -0600, LW Ellis <[EMAIL PROTECTED]>
wrote:
> I'm new to php, but am familar with ASP.
> I have this code to open and read a text file.
> What I need is to take out the 'while' and present the data one line 
> at a time. I read up on fgetcsv, but we will be using one text file 
> per record. I just need to format how it is displayed.

I'm afraid I'm a little fuzzy on what you're attempting to do.  Do you
have a text file with CSV data, and you're trying to split that data
into an array, of which you'd like each element displayed on a separate
line?

[/snip]
I'm also a little fuzzy on what you are attempting, but, it sounds to me
like you might wanna check out the fseek function.
http://www.php.net/fseek
HTH!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] shiflett-clock.gif

2004-10-05 Thread Daniel Purdy

[snip]

> Did anyone ever solve the shiflett-clock.gif puzzle?

What's the puzzle?
[/snip]

Go to http://shiflett.org and scroll down to "the race begins". The
puzzle is the clock.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Simple Time Question

2004-10-21 Thread Daniel Purdy

[snip]
Probably a stupid question, but hopefully has a simple answer.  Is there
a way to get Grenwich Mean time?  time() and date() functions that I can
see only seem to get date/time from the server, which knowing where that
is, could easily figure out GM time, but would rather go the other
way.
[/snip]

You might want to take a look at gmmaketime
http://www.php.net/gmmaketime
HTH!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP book recommendations>

2005-02-14 Thread Daniel Purdy

[snip]
I'm looking for an easy to read PHP book that will help me learn a solid
foundation in PHP.

I'm already familiar with the language but want to make sure I'm coding
in the most efficient manner.

What's a few of the better books out there?
[/snip]
[snip jblanchard:]
I personally like the O'Reilly books on PHP, especially the PHP Cookbook
[/snip]


My personal favorites are the ones with the bright red covers published
by wrox (they are usually just titled the language, so in this case
PHP). I have found they provide excellent quick reference and also are
great for sitting down and reading through to get a better grasp of the
language. HTH!
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calculator Script

2004-04-20 Thread Daniel Purdy

[snip]
 form ax^2 + bx + c by a binomial of the form x - r. 

One example I tried out was (b^2 + 9b - 7) / 3b. 
[/snip]

I don't think that 3b is same form as x - r 
 

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calculator Script

2004-04-20 Thread Daniel Purdy

[snip]
3b = 3x - 0

The book has this as an example too dealing with the program: (x^2 - 14x
-
25) / (3x + 4)
[/snip]

Exactly. However the program is looking for x - r. there is no place to
put a coefficient in front of the x.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Calculator Script

2004-04-20 Thread Daniel Purdy
[snip]
A = 1
B+A*R = 9
C+B*R+A*R^2 = -7

I get (b/3) + 3 - (7/3b) when I work it out by hand, and a teacher of
mine got the same thing. What exactly is this program finding, since it
obviously isn't any coefficients?
[/snip]

Acutally, looking at it further, it looks like it actually almost did it
correctly. If you take the results that the calculator gave you and
divide them by 3 then you get your answer. So the caluclator divides it
by b then you have to add in a part of it to divide by the 3. HTH!!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OK SQL experts...

2004-04-23 Thread Daniel Purdy
>>> I STFW and RTFM and I still can't figure out why this returns a 1064

>>> parse error:
>>>
>>> SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
>>> 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
>>> 'status' = 'active';

Why don't you try rebuilding the query. I mean go into phpmyadmin and
issue select * from `my_table` if that works. Then add on one where
clause
Select * FROM `my_table` WHERE (`field_1 LIKE '%key%' )  , and just put
it back together piece by piece until it breaks. That should at least
help narrow down what is breaking.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] system command?

2004-05-10 Thread Daniel Purdy
[snip]
> Anyone know what this wouldn't work?  I have tried using a couple of
> functions defined at http://us2.php.net/manual/en/ref.exec.php and
none 
> seem to have the desired effect.
> 
>  $tailed = shell_exec('tail -f /path/to/log');
> //$tailed = exec('tail -f /path/to/log');
> //$tailed = system('tail -f /path/to/log');
> print = "$tailed";
> ?>
[/snip]

Take a look at your print statement, print =
"$tailed";
That should throw a parse error. Try print("" . $tailed .
"http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PDF Creating

2004-03-17 Thread Daniel Purdy

[snip]
My question is how to I know how/where the pages will break, and how can
I make the generation of the PDF files work automagically?  The first
page will always have a header set of information, and then the quote
following it, all other pages will just have the quoted items.
[/snip]
My experience has been that the FPDF class will automagicly go to the
next page. You can also play with the function SetAutoPageBreak (see
their online documentation for this function's details) for a bit more
customization. What I usually end up doing for a customized page break
is loop through the data setting a counter and then when the counter
gets to the point where it needs to break use the AddPage function.
Basicly it involves a lot of trial and error, but it should be able to
accomplish what you need. HTH!

Daniel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] saving as .XLS

2004-03-26 Thread Daniel Purdy
[snip]
Hi, I am looking for some information about the way of saving the result
of my php script (html table) with .XLS (ms excel) format. Do you know
where could I get info about this? Thanks,
[/snip]

Take a look at the write excel class, there is a php version of it,
however most of the documentation is in perl
http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-0.37/WriteEx
cel/doc/WriteExcel.html

HTH!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php