[PHP] Help with file downloads.

2009-07-19 Thread tony mount
Hi,
My first post. Been writing php from scratch for about 12 months, mainly
with what I learnt from the web. Have a problem trying to download
multiple files. I'm using the following code:
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
//exit;
}
from the the php manual under "readfile". The files are text files <1Mb
in size. Only the first file is downloaded. (The exit; statement is
excluded). What should I do?
Thanks
Tony


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



Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Eddie Drapkin
On Sun, Jul 19, 2009 at 2:53 AM, Ashley
Sheridan wrote:
> On Sat, 2009-07-18 at 23:09 -0600, Govinda wrote:
>> > i never used x-mapp-php5, but most of a forums say it is specific to
>> > 1and1 hosting service. php recommends application/x-httpd-php
>> >
>> > http://us2.php.net/manual/en/install.unix.apache2.php
>> >
>> > try adding AddType application/x-httpd-php .html in your root htaccess
>>
>> hmmm.   Darn!   I just did try what you suggested above.  Still no luck.
>>
>> > if that dosent help you'll have to add that to your htpd.conf file
>>
>> I am guessing that this means that I am outta luck since I am on a
>> shared hosting environment and assume I do not have access to
>> httpd.conf.
>>
>> Agreed?
>>
>> > It sounds like your .htaccess file may be telling .html files in a /
>> > sub/directory/ to treat .html files as .php
>>
>> I'm sorry I misled everyone.  I just looked better at things and .html
>> files are NOT getting their PHP parsed...  *not anywhere*.   So I
>> assume then that it IS an httpd.conf issue.  (?)   ...and only the
>> host admin can turn this on for me?  (Because if it is something I
>> have control over he is going to give me a hard time ;-)
>>
>> -G
>>
> Generally, if a file has a .html extenstion, then it should really just
> contain html. .php extensions are meant for php code containing html.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

File extension has absolutely no bearing at all on the contents of the
file.  There's valid reasons to not expose what's what under the hood,
especially if there happen to be known exploits in the latest version
of PHP that week.  God forbid that that happens, but it does every so
often.  File mime-type being determined by an extension is entirely M$
Windows mentality and doesn't really extend to *nix environments,
where most of us are hosting our sites, anyway.  You could name your
scripts whatever you want, .awesome, .refridgerator, .silver, whatever
and it'd have no bearing on the files themselves.  It's certainly the
de-factor standard that .html files only contain flat markup, but
that's by no means a rule or anything, but it's common practice
(mostly because programmers are lazy).

Sorry if I sound rude, just quit smoking :)
--Eddie

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



Re: [PHP] Help with file downloads.

2009-07-19 Thread Ashley Sheridan
On Sun, 2009-07-19 at 16:47 +0930, tony mount wrote:
> Hi,
> My first post. Been writing php from scratch for about 12 months, mainly
> with what I learnt from the web. Have a problem trying to download
> multiple files. I'm using the following code:
> if (file_exists($file)) {
> header('Content-Description: File Transfer');
> header('Content-Type: application/octet-stream');
> header('Content-Disposition: attachment; filename='.basename($file));
> header('Content-Transfer-Encoding: binary');
> header('Expires: 0');
> header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
> header('Pragma: public');
> header('Content-Length: ' . filesize($file));
> ob_clean();
> flush();
> readfile($file);
> //exit;
> }
> from the the php manual under "readfile". The files are text files <1Mb
> in size. Only the first file is downloaded. (The exit; statement is
> excluded). What should I do?
> Thanks
> Tony
> 
> 
Is that script in a loop or something, as by itself, it'll only operate
on one file.

Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Stuart
2009/7/19 MEM :
>> Pagination is the generically applicable class - it should know
>> nothing about what specifically it's paginating.
>
> Ok... but I need to grab values of my DAO classes, I mean, even if we 
> paginate images on a directory or records on a database table, the pagination 
> should have a $limit, and a offset, a way to count how many item there are to 
> work with... So it must be related with the DAO (or other thing) on some way, 
> so that I can grab those values and play with them on the pagination class...
>
> Should I use a Decorator Pattern to make this relation between the pagination 
> and the DAO ?

I don't know how your other classes are arranged, but personally I'd
build pagination into a class that provides raw data access, then
inherit that for specific types of data like animals. Efficient
pagination is too tightly coupled to the data source to be separate.

-Stuart

-- 
http://stut.net/

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



[PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
Hello,

I have a Animals DAO class that I'd like to apply a pagination class to it.

Between this two classes, there will be a composition relation (more
precisely, an association one). My question is:

Is a Pagination that "has a" Animal. OR Is a Animal that "has a" pagination?
Should we create on Class Pagination a property named $_animal OR, should we
create on class Animal a property named $_pagination? 

I'm inclined to accept the second one, since, if I put the property $_animal
on my classe Pagination, I will end up, on the Pagination Class, with so
many properties as pagination objects... :s



Any help please?
Márcio


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



RE: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
> Pagination is the generically applicable class - it should know
> nothing about what specifically it's paginating.

Ok... but I need to grab values of my DAO classes, I mean, even if we paginate 
images on a directory or records on a database table, the pagination should 
have a $limit, and a offset, a way to count how many item there are to work 
with... So it must be related with the DAO (or other thing) on some way, so 
that I can grab those values and play with them on the pagination class...

Should I use a Decorator Pattern to make this relation between the pagination 
and the DAO ?


Regards,
Márcio


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



Re: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Stuart
2009/7/19 MEM :
> Hello,
>
> I have a Animals DAO class that I'd like to apply a pagination class to it.
>
> Between this two classes, there will be a composition relation (more
> precisely, an association one). My question is:
>
> Is a Pagination that "has a" Animal. OR Is a Animal that "has a" pagination?
> Should we create on Class Pagination a property named $_animal OR, should we
> create on class Animal a property named $_pagination?
>
> I'm inclined to accept the second one, since, if I put the property $_animal
> on my classe Pagination, I will end up, on the Pagination Class, with so
> many properties as pagination objects... :s

Pagination is the generically applicable class - it should know
nothing about what specifically it's paginating.

-Stuart

-- 
http://stut.net/

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



[PHP] PHP and FoxPro

2009-07-19 Thread Floyd Resler
We currently use the Easysoft ODBC Bridge to connect to a remote  
FoxPro database.  The problem is that the bridge, after a while,  
starts consuming a ton of system resources and we have to reboot the  
machine.  Afterwards, it can take upwards to two hours before  
everything is running quickly again.  We need another solution.  Does  
anyone know of a any other way to connect to a remote FoxPro database  
(or any ODBC source that isn't a database server)?


Thanks!
Floyd


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



RE: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
> I don't know how your other classes are arranged, 

myPDO.class.php -> Singleton. Makes the connection to the database possible.

generalDAO.class.php -> Abstract DAO Class, grabs the myPDO instance and could 
have other methods on the future that are shared for all the DAO classes.

AnimalsDAO.class.php -> DAO class with insertAnimal(); deleteAnimal(); 
updateAnimal(); countAnimal(); selectSpecificAnimam() methods...

The same goes for the VetDAO.class.php.


> but personally I'd
> build pagination into a class that provides raw data access, then
> inherit that for specific types of data like animals. Efficient
> pagination is too tightly coupled to the data source to be separate.

According to the above, does this suggestion of yours still apply? 
If so, what is the buzzword that I should look at so that "inherit that for 
specific types of data like animals" could be possible? What/where should I 
look/search to accomplish your suggestion?


Regards,
Márcio 


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



Re: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Stuart
2009/7/19 MEM :
>> I don't know how your other classes are arranged,
>
> myPDO.class.php -> Singleton. Makes the connection to the database possible.
>
> generalDAO.class.php -> Abstract DAO Class, grabs the myPDO instance and 
> could have other methods on the future that are shared for all the DAO 
> classes.
>
> AnimalsDAO.class.php -> DAO class with insertAnimal(); deleteAnimal(); 
> updateAnimal(); countAnimal(); selectSpecificAnimam() methods...
>
> The same goes for the VetDAO.class.php.
>
>
>> but personally I'd
>> build pagination into a class that provides raw data access, then
>> inherit that for specific types of data like animals. Efficient
>> pagination is too tightly coupled to the data source to be separate.
>
> According to the above, does this suggestion of yours still apply?
> If so, what is the buzzword that I should look at so that "inherit that for 
> specific types of data like animals" could be possible? What/where should I 
> look/search to accomplish your suggestion?

I would say your pagination logic belongs in myPDO.class.php. Where I
have this functionality it's as simple as two arguments to the method
that gets data, $page and $perpage. Setting both to false would
retrieve all rows.

-Stuart

-- 
http://stut.net/

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



RE: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
 
> I would say your pagination logic belongs in myPDO.class.php. Where I
> have this functionality it's as simple as two arguments to the method
> that gets data, $page and $perpage. Setting both to false would
> retrieve all rows.

Interesting but, still no clue, on this side, about how to accomplish that. I'm 
still a newbie. 
Can you throw some key words so that I can google them and look for a way to 
implement that?

Thanks,
Márcio






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



Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Govinda
Generally, if a file has a .html extenstion, then it should really  
just

contain html. .php extensions are meant for php code containing html.



File extension has absolutely no bearing at all on the contents of the
file.  There's valid reasons to not expose what's what under the hood,
especially if there happen to be known exploits in the latest version
of PHP that week.  God forbid that that happens, but it does every so
often.  File mime-type being determined by an extension is entirely M$
Windows mentality and doesn't really extend to *nix environments,
where most of us are hosting our sites, anyway.  You could name your
scripts whatever you want, .awesome, .refridgerator, .silver, whatever
and it'd have no bearing on the files themselves.  It's certainly the
de-factor standard that .html files only contain flat markup, but
that's by no means a rule or anything, but it's common practice
(mostly because programmers are lazy).


Yes, I wanted to hide the .php extension in case any wandering evil- 
doing should find a hole in my site..  until I get really good at  
preventing any possible holes.  I see facebook uses the .php extension  
so I assume there is ultimately nothing to fear, but I'm a php newb.




Sorry if I sound rude, just quit smoking :)


Hey, nice going!  Hang in there!   :-)

-G


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



Re: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Stuart
2009/7/19 MEM :
>
>> I would say your pagination logic belongs in myPDO.class.php. Where I
>> have this functionality it's as simple as two arguments to the method
>> that gets data, $page and $perpage. Setting both to false would
>> retrieve all rows.
>
> Interesting but, still no clue, on this side, about how to accomplish that. 
> I'm still a newbie.
> Can you throw some key words so that I can google them and look for a way to 
> implement that?

I don't know much about PDO, but in raw MySQL SQL you'd have something
similar to this...

function Select($table, $where, $page = false, $perpage = 20)
{
  $sql = 'select * from '.$table.' where '.$where;
  if ($page !== false)
  {
$sql .= ' limit '.(($page-1)*$perpage).', '.$perpage;
  }
  // now run the query and return the results
  ...
}

Obviously this is highly simplified but should give you the general
idea. If you still don't get it I suggest you find something open
source that does pagination (any blogging system should work as an
example) and look at the source code.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Stuart
2009/7/19 Govinda :
>>> Generally, if a file has a .html extenstion, then it should really just
>>> contain html. .php extensions are meant for php code containing html.
>>>
>>
>> File extension has absolutely no bearing at all on the contents of the
>> file.  There's valid reasons to not expose what's what under the hood,
>> especially if there happen to be known exploits in the latest version
>> of PHP that week.  God forbid that that happens, but it does every so
>> often.  File mime-type being determined by an extension is entirely M$
>> Windows mentality and doesn't really extend to *nix environments,
>> where most of us are hosting our sites, anyway.  You could name your
>> scripts whatever you want, .awesome, .refridgerator, .silver, whatever
>> and it'd have no bearing on the files themselves.  It's certainly the
>> de-factor standard that .html files only contain flat markup, but
>> that's by no means a rule or anything, but it's common practice
>> (mostly because programmers are lazy).
>
> Yes, I wanted to hide the .php extension in case any wandering evil-doing
> should find a hole in my site..  until I get really good at preventing any
> possible holes.  I see facebook uses the .php extension so I assume there is
> ultimately nothing to fear, but I'm a php newb.
>
>>
>> Sorry if I sound rude, just quit smoking :)
>
> Hey, nice going!  Hang in there!   :-)

Most security issues have nothing to do with the programming language
and everything to do with the code. Just because "facebook uses the
.php extension" certainly does not mean their code has no security
holes and even if it's clean it certainly doesn't mean your code will
be secure.

If you really want to hide the fact that you're using PHP you need to
make sure that...

* You're not using the .php extension
* You turn expose_php off in your php.ini
* You turn display_errors off in your php.ini

However, I would recommend spending time checking and testing your
code to ensure it's secure since security through obfuscation does not
make your code secure.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Adam Shannon
On Sun, Jul 19, 2009 at 3:39 AM, Eddie Drapkin  wrote:

> On Sun, Jul 19, 2009 at 2:53 AM, Ashley
> Sheridan wrote:
> > On Sat, 2009-07-18 at 23:09 -0600, Govinda wrote:
> >> > i never used x-mapp-php5, but most of a forums say it is specific to
> >> > 1and1 hosting service. php recommends application/x-httpd-php
> >> >
> >> > http://us2.php.net/manual/en/install.unix.apache2.php
> >> >
> >> > try adding AddType application/x-httpd-php .html in your root htaccess
> >>
> >> hmmm.   Darn!   I just did try what you suggested above.  Still no luck.
> >>
> >> > if that dosent help you'll have to add that to your htpd.conf file
> >>
> >> I am guessing that this means that I am outta luck since I am on a
> >> shared hosting environment and assume I do not have access to
> >> httpd.conf.
> >>
> >> Agreed?
> >>
> >> > It sounds like your .htaccess file may be telling .html files in a /
> >> > sub/directory/ to treat .html files as .php
> >>
> >> I'm sorry I misled everyone.  I just looked better at things and .html
> >> files are NOT getting their PHP parsed...  *not anywhere*.   So I
> >> assume then that it IS an httpd.conf issue.  (?)   ...and only the
> >> host admin can turn this on for me?  (Because if it is something I
> >> have control over he is going to give me a hard time ;-)
> >>
> >> -G
> >>
> > Generally, if a file has a .html extenstion, then it should really just
> > contain html. .php extensions are meant for php code containing html.
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> File extension has absolutely no bearing at all on the contents of the
> file.  There's valid reasons to not expose what's what under the hood,
> especially if there happen to be known exploits in the latest version
> of PHP that week.  God forbid that that happens, but it does every so
> often.  File mime-type being determined by an extension is entirely M$
> Windows mentality and doesn't really extend to *nix environments,
> where most of us are hosting our sites, anyway.  You could name your
> scripts whatever you want, .awesome, .refridgerator, .silver, whatever
> and it'd have no bearing on the files themselves.  It's certainly the
> de-factor standard that .html files only contain flat markup, but
> that's by no means a rule or anything, but it's common practice
> (mostly because programmers are lazy).
>
> Sorry if I sound rude, just quit smoking :)
> --Eddie
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Eddie your exactly right, changing file MIME types is often used for
security and protection.  It is harder to know what is behind the "show"
when you don't visually expose it. (A simple curl will give you the HTTP
headers often with PHP as a/the agent.)

-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Jason Pruim


On Jul 19, 2009, at 10:43 AM, Govinda wrote:

Generally, if a file has a .html extenstion, then it should really  
just
contain html. .php extensions are meant for php code containing  
html.




File extension has absolutely no bearing at all on the contents of  
the
file.  There's valid reasons to not expose what's what under the  
hood,

especially if there happen to be known exploits in the latest version
of PHP that week.  God forbid that that happens, but it does every so
often.  File mime-type being determined by an extension is entirely  
M$

Windows mentality and doesn't really extend to *nix environments,
where most of us are hosting our sites, anyway.  You could name your
scripts whatever you want, .awesome, .refridgerator, .silver,  
whatever

and it'd have no bearing on the files themselves.  It's certainly the
de-factor standard that .html files only contain flat markup, but
that's by no means a rule or anything, but it's common practice
(mostly because programmers are lazy).


Yes, I wanted to hide the .php extension in case any wandering evil- 
doing should find a hole in my site..  until I get really good at  
preventing any possible holes.  I see facebook uses the .php  
extension so I assume there is ultimately nothing to fear, but I'm a  
php newb.




Sorry if I sound rude, just quit smoking :)


Hey, nice going!  Hang in there!   :-)


One easy way to do it is to stick the file in a folder So if you  
have a page called: database.php create a folder called database and  
then inside of that name the file index.php Helps to keep the site  
organized too :)




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



[PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Tony Marston
Two things strike me as wrong with your thinking:

(1) The idea that you have a separate DAO for each entity instead of a 
single generic DAO which can act for any entity in the system.
(2) The idea that pagination requires its own class, and therefore needs 
this "is-a" and "has-a" nonsense.

As for (1) even in my pre-OO days I was used to using a single generic DAO 
for all database access. The only time that more than one DAO existed was 
for a different DBMS engine. This is why I have one DAO class for MySQL, one 
for PostgreSQL and another for Oracle. If you are incapable of writing a 
single generic DAO then it just shows that you still have a lot to learn. 
For an idea on how this works take a look at 
http://www.tonymarston.net/php-mysql/databaseobjects.html

As for (2) it should be obvious that pagination is not an entity in its own 
right that has its own properties and methods, it is merely a function which 
can be performed on any entity within the system. It should also be obvious 
that the requirements of pagination cannot be satisfied in a single class as 
some of the processing has to be handled in the presentation (UI) layer 
while the remainder is handled in the data access layer. The presentation 
layer needs a means to submit a request for a particular page number as well 
as the page size (rows per page). These two values are sent to the DAO which 
then translates them into values for LIMIT and OFFSET. After the DAO has 
issued the sql SELECT statement it needs to return two values - the current 
page number and the last available page number. The presentation layer then 
needs a mechanism to display these two values. This is explained in 
http://www.tonymarston.net/php-mysql/pagination.html

If you still don't see how this works then you can run my sample application 
at http://www.tonymarston.net/php-mysql/sample-application.html You can even 
download the code so that you can step through it with your debugger.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org


""MEM""  wrote in message 
news:000701ca0867$992912e0$cb7b38...@com...
Hello,

I have a Animals DAO class that I'd like to apply a pagination class to it.

Between this two classes, there will be a composition relation (more
precisely, an association one). My question is:

Is a Pagination that "has a" Animal. OR Is a Animal that "has a" pagination?
Should we create on Class Pagination a property named $_animal OR, should we
create on class Animal a property named $_pagination?

I'm inclined to accept the second one, since, if I put the property $_animal
on my classe Pagination, I will end up, on the Pagination Class, with so
many properties as pagination objects... :s



Any help please?
Márcio



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



Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Govinda

Most security issues have nothing to do with the programming language
and everything to do with the code. Just because "facebook uses the
.php extension" certainly does not mean their code has no security
holes and even if it's clean it certainly doesn't mean your code will
be secure.


Stuart I hear you.  Writing rock solid code is my aim..  I was just  
trying to cover my butt a little (for whatever very little it is  
worth) in the meanwhile by way of obfuscation.




If you really want to hide the fact that you're using PHP you need to
make sure that...

* You're not using the .php extension


thus my OP.


* You turn expose_php off in your php.ini


what does this one ^^^ do exactly ?


* You turn display_errors off in your php.ini



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



RE: [PHP] Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
> I don't know much about PDO, but in raw MySQL SQL you'd have something
> similar to this...
> 
> function Select($table, $where, $page = false, $perpage = 20)
> {
>   $sql = 'select * from '.$table.' where '.$where;
>   if ($page !== false)
>   {
> $sql .= ' limit '.(($page-1)*$perpage).', '.$perpage;
>   }
>   // now run the query and return the results
>   ...
> }

I believe I understand the pagination logic. 
If I'd like to put some general mysql function, I will put them on the abstract 
DAO class. However, I will not use a general CRUD because a DAO pattern works 
pretty well for now, and I still don't understand if there is any advantage by 
using a general CRUD and DAO together. But, apart from that, I do get the 
pagination logic I believe. What I don't get is how that logic could be related 
with the DAOs.

Anyway, I will try to code some lines to see what comes out...


Regards and thanks for your time Stuart,
Márcio




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



RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
> As for (1) even in my pre-OO days I was used to using a single generic
> DAO
> for all database access. The only time that more than one DAO existed
> was
> for a different DBMS engine. This is why I have one DAO class for MySQL,
> one
> for PostgreSQL and another for Oracle. If you are incapable of writing
> a
> single generic DAO then it just shows that you still have a lot to
> learn.
> For an idea on how this works take a look at
> http://www.tonymarston.net/php-mysql/databaseobjects.html

I'm absolutly sure that I have a lot to learn. Really a lot. :-)
I have post some days ago, a way for using a generic CRUD class and DAO, but
I get no replys so I wrongly suppose that my question was a nonsense
question, and that CRUD and DAO would be a nonsense.


> As for (2) it should be obvious that pagination is not an entity in its
> own
> right that has its own properties and methods, it is merely a function
> which
> can be performed on any entity within the system.

Ok...

> It should also be
> obvious
> that the requirements of pagination cannot be satisfied in a single
> class as
> some of the processing has to be handled in the presentation (UI) layer
> while the remainder is handled in the data access layer. 

That's why I was thinking on using a Decorator Object on the Pagination
Class (that will retrieve DAO values to operate).


> The
> presentation
> layer needs a means to submit a request for a particular page number as
> well
> as the page size (rows per page). These two values are sent to the DAO
> which
> then translates them into values for LIMIT and OFFSET. After the DAO
> has
> issued the sql SELECT statement it needs to return two values - the
> current
> page number and the last available page number. The presentation layer
> then
> needs a mechanism to display these two values. This is explained in
> http://www.tonymarston.net/php-mysql/pagination.html

Thanks for explain the workflow! I will read.

> 
> If you still don't see how this works then you can run my sample
> application
> at http://www.tonymarston.net/php-mysql/sample-application.html You can
> even
> download the code so that you can step through it with your debugger.

I haven't learn how to use a debugger yet. And I'm sure it would help me a
lot on understanding some data workflow...


Thanks,
Márcio 


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



Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Adam Shannon
On Sun, Jul 19, 2009 at 10:00 AM, Govinda wrote:

>  Most security issues have nothing to do with the programming language
>> and everything to do with the code. Just because "facebook uses the
>> .php extension" certainly does not mean their code has no security
>> holes and even if it's clean it certainly doesn't mean your code will
>> be secure.
>>
>
> Stuart I hear you.  Writing rock solid code is my aim..  I was just trying
> to cover my butt a little (for whatever very little it is worth) in the
> meanwhile by way of obfuscation.
>
>
>> If you really want to hide the fact that you're using PHP you need to
>> make sure that...
>>
>> * You're not using the .php extension
>>
>
> thus my OP.
>
>  * You turn expose_php off in your php.ini
>>
>
> what does this one ^^^ do exactly ?


It turns off the "Powered By: PHP v5.30" on Apache/IIS Error messages.


>
>
>  * You turn display_errors off in your php.ini
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Lenin
>
> On Sun, Jul 19, 2009 at 10:00 AM, Govinda  >wrote:
>
> >
> >  * You turn expose_php off in your php.ini
> >>
> >
> > what does this one ^^^ do exactly ?
>
 expose_php boolean

Decides whether PHP may expose the fact that it is installed on the server
(e.g. by adding its signature to the Web server header). It is no security
threat in any way, but it makes it possible to determine whether you use PHP
on your server or not.


RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
> > As for (1) even in my pre-OO days I was used to using a single
> generic
> > DAO
> > for all database access. The only time that more than one DAO existed
> > was
> > for a different DBMS engine. This is why I have one DAO class for
> MySQL,
> > one
> > for PostgreSQL and another for Oracle. If you are incapable of
> writing
> > a
> > single generic DAO then it just shows that you still have a lot to
> > learn.
> > For an idea on how this works take a look at
> > http://www.tonymarston.net/php-mysql/databaseobjects.html
> 
> I'm absolutly sure that I have a lot to learn. Really a lot. :-)
> I have post some days ago, a way for using a generic CRUD class and DAO,
> but I get no replys so I wrongly suppose that my question was a
> nonsense question, and that CRUD and DAO would be a nonsense.
> 

I'm trying to use PDO with prepare statements and BindParam, so I'm afraid
that my "newbility" doesn't allow me to pass directly from your example to
one that uses PDO.
Also, I also intend to use fetchObject method instead of fetchAssoc quite
often, with also puts your tutorial far away from my capacities. Because of
this, I'm trying to follow what I can get on the web, using PDO and general
CRUD operations:

BUT:

Here: 
1) http://oopgarden.richardknop.com/index/view/1

or Here:
2) http://phpro.org/tutorials/Easy-Access-With-PDO-CRUD.html

when we have to create complex querys by using limits, order, etc... either
they are inexistent possibilities (like on the link 2), or, like on link 1
they are so close to the equivalent sql sintax that I'm questioning the
advantage of having a general DAO CRUD class at all (supposing that the only
advantage is that we write less words on the code).

Please advice, besides the fact that we "never have to code any of the SQL
SELECT, INSERT, UPDATE or DELETE statements for any table as they will be
generated at runtime.", is there any other advantage on using a general DAO
class instead of one DAO class for each table?


:(

Regards,
Márcio


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



Re: [PHP] why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Paul M Foster
On Sun, Jul 19, 2009 at 09:30:33AM +0530, kranthi wrote:

> 
> > You do realize that PHP does not parse HTML files, right? The web server
> > does that. In fact, the web server also parses PHP files, using a
> > different library.
>
> Kindly elaborate If you are saying that PHP cant parse files with
> extension .html
> http://us2.php.net/manual/en/security.hiding.php.

That's exactly what I'm saying. Apache or IIS (or whatever) discern the
contents of a file and determine how to parse it. As far as I know,
Apache, even with a PHP file, parses the HTML in the file and hands PHP
off to a PHP module to decode. The PHP engine itself does not parse the
HTML which is interspersed in and amongst your PHP code. The web server
does that. Unless some php internals person says otherwise, that's the
story. At best, the PHP engine would simply echo non-PHP text to the
browser, which is not parsing it.

Paul

-- 
Paul M. Foster

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



Re: [PHP] why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Ashley Sheridan
On Sun, 2009-07-19 at 14:07 -0400, Paul M Foster wrote:
> On Sun, Jul 19, 2009 at 09:30:33AM +0530, kranthi wrote:
> 
> > 
> > > You do realize that PHP does not parse HTML files, right? The web server
> > > does that. In fact, the web server also parses PHP files, using a
> > > different library.
> >
> > Kindly elaborate If you are saying that PHP cant parse files with
> > extension .html
> > http://us2.php.net/manual/en/security.hiding.php.
> 
> That's exactly what I'm saying. Apache or IIS (or whatever) discern the
> contents of a file and determine how to parse it. As far as I know,
> Apache, even with a PHP file, parses the HTML in the file and hands PHP
> off to a PHP module to decode. The PHP engine itself does not parse the
> HTML which is interspersed in and amongst your PHP code. The web server
> does that. Unless some php internals person says otherwise, that's the
> story. At best, the PHP engine would simply echo non-PHP text to the
> browser, which is not parsing it.
> 
> Paul
> 
> -- 
> Paul M. Foster
> 
I thought that files that were deemed to be PHP files (indicated to the
web server by the extension and not the content) were sent to the PHP
parser, and *that* decided what bits went to the web server as regular
output.

Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Stuart
2009/7/19 Paul M Foster :
> On Sun, Jul 19, 2009 at 09:30:33AM +0530, kranthi wrote:
>
>>
>> > You do realize that PHP does not parse HTML files, right? The web server
>> > does that. In fact, the web server also parses PHP files, using a
>> > different library.
>>
>> Kindly elaborate If you are saying that PHP cant parse files with
>> extension .html
>> http://us2.php.net/manual/en/security.hiding.php.
>
> That's exactly what I'm saying. Apache or IIS (or whatever) discern the
> contents of a file and determine how to parse it. As far as I know,
> Apache, even with a PHP file, parses the HTML in the file and hands PHP
> off to a PHP module to decode. The PHP engine itself does not parse the
> HTML which is interspersed in and amongst your PHP code. The web server
> does that. Unless some php internals person says otherwise, that's the
> story. At best, the PHP engine would simply echo non-PHP text to the
> browser, which is not parsing it.

Actually that's not accurate. The web server does nothing with a file
before it passes it to the PHP engine. PHP gets the entire file, it
simply echo's anything not inside PHP tags.

In general web servers don't know or care about the format of the
files they serve. You configure certain extensions to be passed to
certain modules, even in the case of something like SSI. The web
server itself doesn't usually "parse" any of the files it serves.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Tony Marston

""MEM""  wrote in message 
news:002001ca0898$5d183840$1748a8...@com...
> > As for (1) even in my pre-OO days I was used to using a single
> > generic DAO for all database access. The only time that more
> > than one DAO existed was for a different DBMS engine. This
> > is why I have one DAO class for MySQL, one for PostgreSQL
> > and another for Oracle. If you are incapable of writing  a
> > single generic DAO then it just shows that you still have a lot to
> > learn. For an idea on how this works take a look at
> > http://www.tonymarston.net/php-mysql/databaseobjects.html
>
> I'm absolutly sure that I have a lot to learn. Really a lot. :-)
> I have post some days ago, a way for using a generic CRUD class and DAO,
> but I get no replys so I wrongly suppose that my question was a
> nonsense question, and that CRUD and DAO would be a nonsense.
>
> I'm trying to use PDO with prepare statements and BindParam, so I'm afraid
> that my "newbility" doesn't allow me to pass directly from your example to
> one that uses PDO.

Why not? Why can't you replace a call to a mysqli function with a call to a 
PDO function?

> Also, I also intend to use fetchObject method instead of fetchAssoc quite
> often,

Why? What's the  benefit? The fetchAssoc method gives you an array of 
values, while the fetchObject method gives you a container for an array of 
values. You still still have to work with an array of values.

> with also puts your tutorial far away from my capacities. Because of
> this, I'm trying to follow what I can get on the web, using PDO and 
> general
> CRUD operations:

Why don't you learn how to use the mysqli functions before you handle the 
switch to PDO? What do you have to lose?

> BUT:
>
> Here:
> 1) http://oopgarden.richardknop.com/index/view/1
>
> or Here:
> 2) http://phpro.org/tutorials/Easy-Access-With-PDO-CRUD.html
>
> when we have to create complex querys by using limits, order, etc... 
> either
> they are inexistent possibilities (like on the link 2),

If you read my tutorial you should see that building a SELECT statement is 
nothing more than combining several small strings into a larger single 
string. String manipulation is simple in PHP. Using this technique I can 
create very complex SQL statements, so don't tell me that it can't be done.

> or, like on link 1
> they are so close to the equivalent sql sintax that I'm questioning the
> advantage of having a general DAO CRUD class at all (supposing that the 
> only
> advantage is that we write less words on the code).

Having less code to maintain is *precisely* the advantage of having a single 
DAO. If you design it correctly then you can switch from one DAO class to 
another in order to switch from one DBMS engine to aother.

> Please advice, besides the fact that we "never have to code any of the SQL
> SELECT, INSERT, UPDATE or DELETE statements for any table as they will be
> generated at runtime.", is there any other advantage on using a general 
> DAO
> class instead of one DAO class for each table?

Because you have less code to maintain. If you look carefully you should see 
that the only difference between the DAO for TableA and the DAO for TableB 
is the table name and the table structure. If you could pass these as 
arguments into a generic DAO then you would not need a separate DAO for each 
table.

OOP is about creating reusable code to reduce the maintenance burden, so if 
you insist that a separate DAO for each individual table is the way to go 
then you don't understand how to apply the principles of OOP correctly.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org



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



RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread MEM
> Why not? Why can't you replace a call to a mysqli function with a call
> to a
> PDO function?

It's not just a simple replacement - I need to add bindparam, prepare,
execute, placeholders and fetchObject. But I will give it a try...
 
> > Also, I also intend to use fetchObject method instead of fetchAssoc
> quite
> > often,
> 
> Why? What's the  benefit? The fetchAssoc method gives you an array of
> values, while the fetchObject method gives you a container for an array
> of
> values. You still still have to work with an array of values.

FetchObject maps the field names from the database as object properties with
the values stored in the database. Seems quite nice.

Then, to access a specific column data I just needed to:
$myhandler->my_database_column_name (it seems quite nice to me) :) 

 
> Why don't you learn how to use the mysqli functions before you handle
> the
> switch to PDO? What do you have to lose?

I already work with PDO so, no need to switch. :-)


> If you read my tutorial you should see that building a SELECT statement
> is
> nothing more than combining several small strings into a larger single
> string. String manipulation is simple in PHP. Using this technique I
> can
> create very complex SQL statements, so don't tell me that it can't be
> done.

I was not talking about your tutorial. I was talking about those two links,
mainly the first one where, unfortunately, the difference between the code
and the sql sintax is that we don't have the word SELECT and WHERE. :s
However, as a positive point, this class uses BindParam and ? placeholders.
But I get your point, we can cut it into smaller strings.


> Because you have less code to maintain. If you look carefully you
> should see
> that the only difference between the DAO for TableA and the DAO for
> TableB
> is the table name and the table structure. If you could pass these as
> arguments into a generic DAO then you would not need a separate DAO for
> each
> table.

Yes. But you still need, for each table, to fill one or several (depending
on what mysql connection method we use) arrays with values.
So that "less code" maybe isn't that much in a way where you *significantly*
reduce your maintenance burden, if you take into consideration that we take
the queries for each table, but a) we add arrays and b) use a less intuitive
way to add/remove/delete values to the database. As an example I have give
link 1, where the difference was more or less two or three words - and the
way to use the arrays where far more complicated to understand then a simple
Select Sintax - hence, not that relevant.

 
> OOP is about creating reusable code to reduce the maintenance burden,
> so if
> you insist that a separate DAO for each individual table is the way to
> go
> then you don't understand how to apply the principles of OOP correctly.

I will never insist just because some silly reason comes to my mind. I will
however not follow a method without knowing the reasons and be convinced of
them.


I'm not 100% convinced of the reducing benefits for the reasons a) and b)
stated above, still, maybe I get more benefits the more I add methods to the
DAOs.


In the next few days I will try to, based on your code, create a general DAO
class that deals with PDO. And post back my frustrations back here. :D


Please have patience. :D


Regards,
Márcio





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



Re: [PHP] PHP and FoxPro

2009-07-19 Thread Paul M Foster
On Sun, Jul 19, 2009 at 09:00:49AM -0400, Floyd Resler wrote:

> We currently use the Easysoft ODBC Bridge to connect to a remote
> FoxPro database.  The problem is that the bridge, after a while,
> starts consuming a ton of system resources and we have to reboot the
> machine.  Afterwards, it can take upwards to two hours before
> everything is running quickly again.  We need another solution.  Does
> anyone know of a any other way to connect to a remote FoxPro database
> (or any ODBC source that isn't a database server)?

No way to convert the FoxPro to PostgreSQL or MySQL? FoxPro is ancient
and decrepit (I used to code in FoxPro).

There is a dBase module for PHP. I don't know if it handles generic
xBase files. I don't know much about the module, but you could check it
out.

Paul
-- 
Paul M. Foster

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



Re: [PHP] why does PHP parse "*.html" files in one subdir/ but not in another?

2009-07-19 Thread Paul M Foster
On Sun, Jul 19, 2009 at 07:18:34PM +0100, Stuart wrote:

> 2009/7/19 Paul M Foster :
> > On Sun, Jul 19, 2009 at 09:30:33AM +0530, kranthi wrote:
> >
> >>
> >> > You do realize that PHP does not parse HTML files, right? The web server
> >> > does that. In fact, the web server also parses PHP files, using a
> >> > different library.
> >>
> >> Kindly elaborate If you are saying that PHP cant parse files with
> >> extension .html
> >> http://us2.php.net/manual/en/security.hiding.php.
> >
> > That's exactly what I'm saying. Apache or IIS (or whatever) discern the
> > contents of a file and determine how to parse it. As far as I know,
> > Apache, even with a PHP file, parses the HTML in the file and hands PHP
> > off to a PHP module to decode. The PHP engine itself does not parse the
> > HTML which is interspersed in and amongst your PHP code. The web server
> > does that. Unless some php internals person says otherwise, that's the
> > story. At best, the PHP engine would simply echo non-PHP text to the
> > browser, which is not parsing it.
> 
> Actually that's not accurate. The web server does nothing with a file
> before it passes it to the PHP engine. PHP gets the entire file, it
> simply echo's anything not inside PHP tags.

Then I stand corrected. But again, this means that PHP doesn't actually
*parse* the HTML it echoes.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.

2009-07-19 Thread Paul M Foster
On Sun, Jul 19, 2009 at 03:56:43PM +0100, Tony Marston wrote:

> Two things strike me as wrong with your thinking:
> 
> (1) The idea that you have a separate DAO for each entity instead of a
> single generic DAO which can act for any entity in the system.
> (2) The idea that pagination requires its own class, and therefore needs
> this "is-a" and "has-a" nonsense.
> 
> As for (1) even in my pre-OO days I was used to using a single generic DAO
> for all database access. The only time that more than one DAO existed was
> for a different DBMS engine. This is why I have one DAO class for MySQL, one
> for PostgreSQL and another for Oracle. If you are incapable of writing a
> single generic DAO then it just shows that you still have a lot to learn.
> For an idea on how this works take a look at
> http://www.tonymarston.net/php-mysql/databaseobjects.html

This brings up a question. Most of the tutorials I've read on your site
deal with classes tailored to specific tables. However, in much of my
software, I have to deal with queries which access multiple tables. For
example, my invoice table contains the customer number, but not their
name. For that, I have to go to the customer table. Thus, my queries
often access multiple tables with where clauses which ensure I get the
proper data from secondary tables. I've never used "views" in SQL, but
it appears that this is what would be called a "view".

So in your constellation of software, would you create a subclass of
genericTable which essentially is a "view"? Otherwise, how would you
handle this?

Paul

-- 
Paul M. Foster

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



Re: [PHP] Re: Newbie: Composition by Association - PaginationClass general question.

2009-07-19 Thread Tony Marston

"Paul M Foster"  wrote in message 
news:20090719220923.gv14...@quillandmouse.com...
> On Sun, Jul 19, 2009 at 03:56:43PM +0100, Tony Marston wrote:
>
>> Two things strike me as wrong with your thinking:
>>
>> (1) The idea that you have a separate DAO for each entity instead of a
>> single generic DAO which can act for any entity in the system.
>> (2) The idea that pagination requires its own class, and therefore needs
>> this "is-a" and "has-a" nonsense.
>>
>> As for (1) even in my pre-OO days I was used to using a single generic 
>> DAO
>> for all database access. The only time that more than one DAO existed was
>> for a different DBMS engine. This is why I have one DAO class for MySQL, 
>> one
>> for PostgreSQL and another for Oracle. If you are incapable of writing a
>> single generic DAO then it just shows that you still have a lot to learn.
>> For an idea on how this works take a look at
>> http://www.tonymarston.net/php-mysql/databaseobjects.html
>
> This brings up a question. Most of the tutorials I've read on your site
> deal with classes tailored to specific tables. However, in much of my
> software, I have to deal with queries which access multiple tables. For
> example, my invoice table contains the customer number, but not their
> name. For that, I have to go to the customer table. Thus, my queries
> often access multiple tables with where clauses which ensure I get the
> proper data from secondary tables. I've never used "views" in SQL, but
> it appears that this is what would be called a "view".
>
> So in your constellation of software, would you create a subclass of
> genericTable which essentially is a "view"? Otherwise, how would you
> handle this?
>
> Paul

Such things can be handled automatically by my generic DAO. Amongst the 
details which are exported from my data dictionary into each table structure 
file (which is accessed by the database table class) is a list of all the 
parent/foreign tables, the foreign key field(s), and which fields to 
retrieve from the parent table. So when the sql SELECT statement is being 
constructed it can use this information to add a JOIN to the parent table in 
order to retrieve the specified field(s). This is documented in 
http://www.tonymarston.net/php-mysql/data-dictionary.html#sql.joins

Any number of parent relations can be defined for a table, and any number of 
fields can be retrieved from those tables and added to the SELECT list. All 
the developer has to do is define the relationship in the data dictionary 
and the framework will handle the boring stuff of generating the necessary 
SQL.

So, using your example, I would define my customer table as a parent to my 
invoice table, identify which foreign key field relates to which primary key 
field in the parent table, define customer_name as the field to be retrieved 
from the customer table, then sit back and watch the framework do its stuff. 
Each time I read from the invoice table the result would automatically 
include the customer name.

Easy peasy lemon squeezy. It's not rocket science, but it is neat.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org 



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



Re: [PHP] Dual PHP installation and session sharing

2009-07-19 Thread Zareef Ahmed
On Sat, Jul 18, 2009 at 1:34 AM, Bruno Fajardo  wrote:

> Hi all,
>
> I'm using Apache/2.2.3 (Linux/SUSE), running PHP 4.4.7 in CGI mode, in a
> dual installation with PHP 5.1.2 running as an Apache module.
> Scripts with .php5 extension are executed by PHP 5, and those with .php are
> executed by PHP 4, and everything runs as expected.
> My question is: is it possible to share session data between .php and .php5
> scripts in this environment? All my tests failed.


have you tried using database as session storage and setting session id
manually in your application.

>
>
> Thanks in advance!
>



-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net


[PHP] file_set_contents() do several times?

2009-07-19 Thread Martin Zvarík



Makes sense? or is it enough to do it just once?

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



Re: [PHP] file_set_contents() do several times?

2009-07-19 Thread Jim Lucas

Martin Zvarík wrote:



Makes sense? or is it enough to do it just once?



You call file_put_contents() once.

it writes an entire file when called.

use fopen/fwrite/fclose to do it line by line.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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