|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Thu Apr 17 2008 - 16:30:27 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 17 Apr 2008 21:30:27 -0000 Issue 5410
Topics (messages 273145 through 273212):
Re: PHP with NNTP?
273145 by: Stut
Re: FRench characters not displayed correctly
273146 by: Angelo Zanetti
273148 by: Robert Cummings
273149 by: Per Jessen
273150 by: Angelo Zanetti
273151 by: Robert Cummings
273154 by: Angelo Zanetti
273156 by: Robert Cummings
273157 by: Per Jessen
273158 by: Per Jessen
273160 by: Robert Cummings
273161 by: Per Jessen
PHP5 and the DOM model
273147 by: Michael Preminger
DateTime... What else ?
273152 by: David BERCOT
273153 by: Simon Welsh
273155 by: Stut
273163 by: David BERCOT
273164 by: David BERCOT
Re: What is the practical use of "abstract" and "interface"?
273159 by: Robin Vickery
273187 by: Nathan Nobbe
Re: & performance issues
273162 by: Bojan Tesanovic
273188 by: Nathan Nobbe
273189 by: Nathan Nobbe
273203 by: Eric Butera
Re: Hack question
273165 by: Al
273171 by: Daniel Brown
Re: Database abstraction?
273166 by: Jason Pruim
273167 by: Jason Pruim
273168 by: Stut
273172 by: Daniel Brown
273173 by: Richard Heyes
273174 by: Richard Heyes
273175 by: Daniel Brown
273176 by: Jason Pruim
273177 by: Daniel Brown
273178 by: Richard Heyes
273182 by: Jim Lucas
273204 by: Jason Pruim
273206 by: Jim Lucas
273207 by: Jason Pruim
273208 by: Jim Lucas
273209 by: Jim Lucas
273210 by: Jim Lucas
273211 by: Jason Pruim
kadm5
273169 by: Donald Miller
273170 by: Daniel Brown
FROM httpd.conf TO .htaccess
273179 by: Alberto García Gómez
273180 by: Daniel Brown
273181 by: Wolf
CAN NOT read qmail
273183 by: Yui Hiroaki
273184 by: Jay Blanchard
273185 by: Yui Hiroaki
273186 by: Jay Blanchard
273192 by: Yui Hiroaki
273199 by: Jay Blanchard
273201 by: Yui Hiroaki
Re: Most viewed?
273190 by: Philip Thompson
273194 by: Andrew Ballard
273196 by: Richard Heyes
Re: Newbie question about sending email
273191 by: Pete Holsberg
273193 by: Daniel Brown
273195 by: Pete Holsberg
273197 by: Daniel Brown
273198 by: Pete Holsberg
273200 by: Daniel Brown
Re: SERVER_PORT always at 80 ?
273202 by: Julien Pauli
module access rights
273205 by: Alain Roger
PHP console script vs C/C++/C#
273212 by: Daniel Kolbo
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On 16 Apr 2008, at 23:50, vester_s wrote:
> I need to get the list for all of the people that subscribing to this
> newsreader, this list will be used to modify the other mailing list
> programs.
>
> Basically by getting the list of the people that subscribing on this
> newsgroup, then i could migrate it to our new forum based.
>
> So is it possible for getting those list?
Really not sure what you mean by "modify the other mailing list
programs".
And nobody subscribed to this mailing list has agreed to have an
account on your new forum.
So no, I won't help you get their details.
Have a cracking day.
-Stut
--
http://stut.net/
> Stut wrote:
>>
>> On 16 Apr 2008, at 18:01, vester_s wrote:
>>> Is it possible to do it without using imap? I am trying to get the
>>> list of
>>> all users that is on the newsgroup, is that possible?
>>
>> I'm wondering what possible legitimate reason you could have for
>> wanting that list?
>>
>> There is a way to get it (it's not easy but it's possible) but
>> until I
>> know why you want it I'm not sharing.
>>
>> -Stut
>>
>> --
>> http://stut.net/
>>
>>> chris smith-9 wrote:
>>>>
>>>> vester_s wrote:
>>>>> Hi,
>>>>>
>>>>> Can anybody tell me how can php connect to NNTP to get the list of
>>>>> all
>>>>> users
>>>>> in the newsgroups?
>>>>
>>>> http://php.net/imap supports nntp.
>>>>
>>>> --
>>>> Postgresql & php tutorials
>>>> http://www.designmagick.com/
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/PHP-with-NNTP--tp16713817p16723692.html
>>> Sent from the PHP - General mailing list archive at Nabble.com.
>>>
>>>
>>> --
>>> 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
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/PHP-with-NNTP--tp16713817p16735336.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
-----Original Message-----
From: Angelo Zanetti [mailto:angelo
elemental.co.za]
Sent: 17 April 2008 09:48
To: php-general
lists.php.net
Subject: [PHP] FRench characters not displayed correctly
Hi all.
We have taken over a site and a problem we have is that French special
characters aren't displaying correctly, they are displaying a weird square
block.
I have checked the content type and it's as follows:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
I also notice that the "charset=iso-8859-1" is missing in the above meta
tag, could this be affecting the characters?
I have seen that there is no DOCTYPE declaration, could this be the problem
if this is omitted?
If you have any suggestions, please let me know.
TIA.
Angelo
Web: http://www.elemental.co.za
========================================
I have also found that we can do this:
<html lang="fr">
But I am interested in finding out if the doctype declaration is a
contributing factor.
Thanks
Angelo
attached mail follows:
On Thu, 2008-04-17 at 09:47 +0200, Angelo Zanetti wrote:
> Hi all.
>
> We have taken over a site and a problem we have is that French special
> characters aren't displaying correctly, they are displaying a weird square
> block.
>
> I have checked the content type and it's as follows:
>
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
>
> I also notice that the "charset=iso-8859-1" is missing in the above meta
> tag, could this be affecting the characters?
You certainly wouldn't want both utf-8 and iso-8859-1 declared at the
same time. It sounds like what you want is iso-8859-1 and NOT utf-8.
Check the encoding of either your files or your database content. Also
check what headers PHP is sending to the browser. If you're using
Firefox you can check the page info to see what charset it thinks it
received.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
Angelo Zanetti wrote:
> I have also found that we can do this:
>
> <html lang="fr">
>
> But I am interested in finding out if the doctype declaration is a
> contributing factor.
Neither will affect the character set used when rendering the page.
The meta http-equiv="Content-Type" in a page is ignored by the browser
if an http header with a Content-Type has already been sent. If you
bring up the page in Firefox, and hit Ctrl-I, I'll bet it says the page
is being displayed in ISO-8859-1 (well, not UTF8 at least).
I would check the default_charset setting in php.ini.
/Per Jessen, Zürich
attached mail follows:
-----Original Message-----
From: Robert Cummings [mailto:robert
interjinn.com]
Sent: 17 April 2008 10:38
To: Angelo Zanetti
Cc: php-general
lists.php.net
Subject: Re: [PHP] FRench characters not displayed correctly
On Thu, 2008-04-17 at 09:47 +0200, Angelo Zanetti wrote:
> Hi all.
>
> We have taken over a site and a problem we have is that French special
> characters aren't displaying correctly, they are displaying a weird square
> block.
>
> I have checked the content type and it's as follows:
>
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
>
> I also notice that the "charset=iso-8859-1" is missing in the above meta
> tag, could this be affecting the characters?
You certainly wouldn't want both utf-8 and iso-8859-1 declared at the
same time. It sounds like what you want is iso-8859-1 and NOT utf-8.
Check the encoding of either your files or your database content. Also
check what headers PHP is sending to the browser. If you're using
Firefox you can check the page info to see what charset it thinks it
received.
Cheers,
Rob.
--
Thanks Robert,
I have the following headers:
http://fr.xxxx.com/student/themes/english/locker_room/student.html
GET /student/themes/english/locker_room/student.html? HTTP/1.1
Host: fr.xxxx.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14)
Gecko/20080404 Firefox/2.0.0.14
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://fr.xxxx.com/student/themes/english/locker_room/student.html
Cookie: PHPSESSID=818678404c170c8e4f5d237c1d0280a8
If-Modified-Since: Sat, 17 Nov 2007 11:40:26 GMT
If-None-Match: "6b97e-a9d-619b9e80"
Cache-Control: max-age=0
HTTP/1.x 304 Not Modified
Date: Thu, 17 Apr 2008 08:31:32 GMT
Server: Apache/2.0.55 (Unix) PHP/5.1.2
Connection: Keep-Alive
Keep-Alive: timeout=15, max=200
Etag: "6b97e-a9d-619b9e80"
-----------------------------
Now I see that the headers have:
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Which to me seems like it is sending both ISO-8859-1 and UTF-8?
What else should I be checking for?
Could it be a PHP problem where PHP isn't decoding the characters properly?
Thanks again.
attached mail follows:
On Thu, 2008-04-17 at 10:57 +0200, Angelo Zanetti wrote:
>
> Thanks Robert,
>
> I have the following headers:
>
>
> http://fr.xxxx.com/student/themes/english/locker_room/student.html
>
> GET /student/themes/english/locker_room/student.html? HTTP/1.1
> Host: fr.xxxx.com
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14)
> Gecko/20080404 Firefox/2.0.0.14
> Accept:
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
> 0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://fr.xxxx.com/student/themes/english/locker_room/student.html
> Cookie: PHPSESSID=818678404c170c8e4f5d237c1d0280a8
> If-Modified-Since: Sat, 17 Nov 2007 11:40:26 GMT
> If-None-Match: "6b97e-a9d-619b9e80"
> Cache-Control: max-age=0
>
> HTTP/1.x 304 Not Modified
> Date: Thu, 17 Apr 2008 08:31:32 GMT
> Server: Apache/2.0.55 (Unix) PHP/5.1.2
> Connection: Keep-Alive
> Keep-Alive: timeout=15, max=200
> Etag: "6b97e-a9d-619b9e80"
> -----------------------------
>
>
> Now I see that the headers have:
>
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>
> Which to me seems like it is sending both ISO-8859-1 and UTF-8?
No, that's what kind of content the server is willing to accept from
various sources such as POST. You want the following somewhere near the
beginning of your script:
<?php
header( 'Content-type: text/html; charset=iso-8859-1' );
?>
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
-----Original Message-----
From: Robert Cummings [mailto:robert
interjinn.com]
Sent: 17 April 2008 11:05
To: Angelo Zanetti
Cc: php-general
lists.php.net
Subject: RE: [PHP] FRench characters not displayed correctly
On Thu, 2008-04-17 at 10:57 +0200, Angelo Zanetti wrote:
>
> Thanks Robert,
>
> I have the following headers:
>
>
> http://fr.xxxx.com/student/themes/english/locker_room/student.html
>
> GET /student/themes/english/locker_room/student.html? HTTP/1.1
> Host: fr.xxxx.com
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14)
> Gecko/20080404 Firefox/2.0.0.14
> Accept:
>
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
> 0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer:
http://fr.xxxx.com/student/themes/english/locker_room/student.html
> Cookie: PHPSESSID=818678404c170c8e4f5d237c1d0280a8
> If-Modified-Since: Sat, 17 Nov 2007 11:40:26 GMT
> If-None-Match: "6b97e-a9d-619b9e80"
> Cache-Control: max-age=0
>
> HTTP/1.x 304 Not Modified
> Date: Thu, 17 Apr 2008 08:31:32 GMT
> Server: Apache/2.0.55 (Unix) PHP/5.1.2
> Connection: Keep-Alive
> Keep-Alive: timeout=15, max=200
> Etag: "6b97e-a9d-619b9e80"
> -----------------------------
>
>
> Now I see that the headers have:
>
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>
> Which to me seems like it is sending both ISO-8859-1 and UTF-8?
No, that's what kind of content the server is willing to accept from
various sources such as POST. You want the following somewhere near the
beginning of your script:
<?php
header( 'Content-type: text/html; charset=iso-8859-1' );
?>
Cheers,
Rob.
---------------------------------------------------------
Thanks again, but as far as I have read, it seems that UTF-8 has better
handling for French characters?
We have the following in our HTML page:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
Would the header not conflict with this meta tag?
Angelo
attached mail follows:
On Thu, 2008-04-17 at 11:11 +0200, Angelo Zanetti wrote:
>
> -----Original Message-----
> From: Robert Cummings [mailto:robert
interjinn.com]
> Sent: 17 April 2008 11:05
> To: Angelo Zanetti
> Cc: php-general
lists.php.net
> Subject: RE: [PHP] FRench characters not displayed correctly
>
>
> On Thu, 2008-04-17 at 10:57 +0200, Angelo Zanetti wrote:
> >
> > Thanks Robert,
> >
> > I have the following headers:
> >
> >
> > http://fr.xxxx.com/student/themes/english/locker_room/student.html
> >
> > GET /student/themes/english/locker_room/student.html? HTTP/1.1
> > Host: fr.xxxx.com
> > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14)
> > Gecko/20080404 Firefox/2.0.0.14
> > Accept:
> >
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
> > 0.8,image/png,*/*;q=0.5
> > Accept-Language: en-us,en;q=0.5
> > Accept-Encoding: gzip,deflate
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive: 300
> > Connection: keep-alive
> > Referer:
> http://fr.xxxx.com/student/themes/english/locker_room/student.html
> > Cookie: PHPSESSID=818678404c170c8e4f5d237c1d0280a8
> > If-Modified-Since: Sat, 17 Nov 2007 11:40:26 GMT
> > If-None-Match: "6b97e-a9d-619b9e80"
> > Cache-Control: max-age=0
> >
> > HTTP/1.x 304 Not Modified
> > Date: Thu, 17 Apr 2008 08:31:32 GMT
> > Server: Apache/2.0.55 (Unix) PHP/5.1.2
> > Connection: Keep-Alive
> > Keep-Alive: timeout=15, max=200
> > Etag: "6b97e-a9d-619b9e80"
> > -----------------------------
> >
> >
> > Now I see that the headers have:
> >
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> >
> > Which to me seems like it is sending both ISO-8859-1 and UTF-8?
>
> No, that's what kind of content the server is willing to accept from
> various sources such as POST. You want the following somewhere near the
> beginning of your script:
>
> <?php
>
> header( 'Content-type: text/html; charset=iso-8859-1' );
>
> ?>
>
> Cheers,
> Rob.
> ---------------------------------------------------------
>
> Thanks again, but as far as I have read, it seems that UTF-8 has better
> handling for French characters?
>
> We have the following in our HTML page:
>
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
>
>
> Would the header not conflict with this meta tag?
You can't just change the header or meta tags and expect things to work.
The header must match the type of content you have. The point of th
eheader is to tell the browser what all those multi-byte sequences mean.
If you want to change to UTF-8 and your data is in ISO-8859-1 then you
need to convert the content from one type to the other (I usually use
iconv on the command-line). Until you do so, you should set your header
to whatever content type you have... I'm guessing ISO-8859-1 but maybe
you have UTF-8.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
Angelo Zanetti wrote:
> Thanks again, but as far as I have read, it seems that UTF-8 has
> better handling for French characters?
Not really - I'm pretty certain ISO-8859-1 will cover all of the special
french characters. But it's irrelevant - if your code/pages are
written in UTF8, you won't get the desired result if you serve them as
ISO-8859-1.
> We have the following in our HTML page:
>
> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
>
> Would the header not conflict with this meta tag?
No, your header didn't have a Content-Type listed, so I think your
meta-tag should work.
/Per Jessen, Zürich
attached mail follows:
Robert Cummings wrote:
> No, that's what kind of content the server is willing to accept from
> various sources such as POST. You want the following somewhere near
> the beginning of your script:
>
> <?php
> header( 'Content-type: text/html; charset=iso-8859-1' );
> ?>
I think that is better done with the default_charset setting in php.ini.
/Per Jessen, Zürich
attached mail follows:
On Thu, 2008-04-17 at 11:39 +0200, Per Jessen wrote:
> Robert Cummings wrote:
>
> > No, that's what kind of content the server is willing to accept from
> > various sources such as POST. You want the following somewhere near
> > the beginning of your script:
> >
> > <?php
> > header( 'Content-type: text/html; charset=iso-8859-1' );
> > ?>
>
> I think that is better done with the default_charset setting in php.ini.
I don't. But then I have several projects and some use utf-8 (preferred)
and some use iso-8859-1 (not preferred). I prefer it in the virtual host
config personally :)
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
Robert Cummings wrote:
>> >
>> > <?php
>> > header( 'Content-type: text/html; charset=iso-8859-1' );
>> > ?>
>>
>> I think that is better done with the default_charset setting in
>> php.ini.
>
> I don't. But then I have several projects and some use utf-8
> (preferred) and some use iso-8859-1 (not preferred). I prefer it in
> the virtual host config personally :)
Ah yes, that's what I meant of course. (I actually do everything in
UTF8 anyway).
/Per Jessen, Zürich
attached mail follows:
Hello!
Seems that PHP gets more and more object oriented, which is good.
I am now running a course in PHP, using PHP 5, where we are going to
use the *DOM* interface. I am trying to teach them good OO practices,
meaning that we insistently hide properties and expose them as get or
set methods.
Looking at the PHPs *DOM* implementation, I see that many of the
properties are exposed directly, without even offering get methods.
1. Is there something I am misunderstanding orotherwise missing? (I
havenot used *DOM* in PHP before).
2.This poses a pedagogical problem for me as a teacher. How do I
explain this contradiction to my students?
Thanks
Michael
attached mail follows:
Hi,
I've got a problem with DateTime. I have a short code which gives an
error :
<CODE>
$date = new DateTime(date("d/m/Y"));
$date->modify("-1 month");
$mois_en_cours1 = $date->format("Y-m");
$date->modify("-1 month");
$mois_en_cours2 = $date->format("Y-m");
$date->modify("-1 month");
$mois_en_cours3 = $date->format("Y-m");
</CODE>
<ERROR>
<b>Fatal error</b>: Class 'DateTime' not found in
<b>/var/www2/dacg_visio/index.html</b> on line <b>244</b><br />
</ERROR>
If I look at the documentation :
http://fr3.php.net/manual/fr/function.date-modify.php
it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
Do you have any idea about this error (Debian/Apache2) ?
Do you have another way to obtain $mois_en_cours1, 2, 3 without
DateTime ?
Thank you very much.
David.
attached mail follows:
On 17/04/2008, at 9:05, David BERCOT wrote:
> Hi,
>
> I've got a problem with DateTime. I have a short code which gives an
> error :
>
> <CODE>
> $date = new DateTime(date("d/m/Y"));
> $date->modify("-1 month");
> $mois_en_cours1 = $date->format("Y-m");
> $date->modify("-1 month");
> $mois_en_cours2 = $date->format("Y-m");
> $date->modify("-1 month");
> $mois_en_cours3 = $date->format("Y-m");
> </CODE>
>
> <ERROR>
> <b>Fatal error</b>: Class 'DateTime' not found in
> <b>/var/www2/dacg_visio/index.html</b> on line <b>244</b><br />
> </ERROR>
>
> If I look at the documentation :
> http://fr3.php.net/manual/fr/function.date-modify.php
> it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
>
> Do you have any idea about this error (Debian/Apache2) ?
> Do you have another way to obtain $mois_en_cours1, 2, 3 without
> DateTime ?
>
> Thank you very much.
>
> David.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
<?php
$mois_en_cours1 = date('Y-m', strtotime('-1 month'));
$mois_en_cours2 = date('Y-m', strtotime('-2 month'));
$mois_en_cours3 = date('Y-m', strtotime('-3 month'));
?>
---
Simon Welsh
Admin of http://simon.geek.nz/
Windows is a joke operating system. Hell, it's not even an operating
system. NT is Not Tough enough for me either. 95 is how may times it
will crash an hour.
http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e
attached mail follows:
On 17 Apr 2008, at 10:05, David BERCOT wrote:
> I've got a problem with DateTime. I have a short code which gives an
> error :
>
> <CODE>
> $date = new DateTime(date("d/m/Y"));
> $date->modify("-1 month");
> $mois_en_cours1 = $date->format("Y-m");
> $date->modify("-1 month");
> $mois_en_cours2 = $date->format("Y-m");
> $date->modify("-1 month");
> $mois_en_cours3 = $date->format("Y-m");
> </CODE>
>
> <ERROR>
> <b>Fatal error</b>: Class 'DateTime' not found in
> <b>/var/www2/dacg_visio/index.html</b> on line <b>244</b><br />
> </ERROR>
>
> If I look at the documentation :
> http://fr3.php.net/manual/fr/function.date-modify.php
> it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
>
> Do you have any idea about this error (Debian/Apache2) ?
> Do you have another way to obtain $mois_en_cours1, 2, 3 without
> DateTime ?
Pre-5.2 you need to explicitly say you want the DateTime class. See
the note on this page: http://fr3.php.net/manual/fr/datetime.installation.php
Also note that it's experimental at the moment and therefore not
recommended for production usage.
-Stut
--
http://stut.net/
attached mail follows:
Hi again,
Le Thu, 17 Apr 2008 21:10:44 +1200,
Simon Welsh <simon
welsh.co.nz> a écrit :
> On 17/04/2008, at 9:05, David BERCOT wrote:
> > Hi,
> >
> > I've got a problem with DateTime. I have a short code which gives an
> > error :
> >
> > <CODE>
> > $date = new DateTime(date("d/m/Y"));
> > $date->modify("-1 month");
> > $mois_en_cours1 = $date->format("Y-m");
> > $date->modify("-1 month");
> > $mois_en_cours2 = $date->format("Y-m");
> > $date->modify("-1 month");
> > $mois_en_cours3 = $date->format("Y-m");
> > </CODE>
> >
> > <ERROR>
> > <b>Fatal error</b>: Class 'DateTime' not found in
> > <b>/var/www2/dacg_visio/index.html</b> on line <b>244</b><br />
> > </ERROR>
> >
> > If I look at the documentation :
> > http://fr3.php.net/manual/fr/function.date-modify.php
> > it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
> >
> > Do you have any idea about this error (Debian/Apache2) ?
> > Do you have another way to obtain $mois_en_cours1, 2, 3 without
> > DateTime ?
> >
> > Thank you very much.
> >
> > David.
> >
> <?php
> $mois_en_cours1 = date('Y-m', strtotime('-1 month'));
> $mois_en_cours2 = date('Y-m', strtotime('-2 month'));
> $mois_en_cours3 = date('Y-m', strtotime('-3 month'));
> ?>
Great ;-)
Thank you very much !
David.
attached mail follows:
Le Thu, 17 Apr 2008 10:19:10 +0100,
Stut <stuttle
gmail.com> a écrit :
> On 17 Apr 2008, at 10:05, David BERCOT wrote:
> > I've got a problem with DateTime. I have a short code which gives an
> > error :
> >
> > <CODE>
> > $date = new DateTime(date("d/m/Y"));
> > $date->modify("-1 month");
> > $mois_en_cours1 = $date->format("Y-m");
> > $date->modify("-1 month");
> > $mois_en_cours2 = $date->format("Y-m");
> > $date->modify("-1 month");
> > $mois_en_cours3 = $date->format("Y-m");
> > </CODE>
> >
> > <ERROR>
> > <b>Fatal error</b>: Class 'DateTime' not found in
> > <b>/var/www2/dacg_visio/index.html</b> on line <b>244</b><br />
> > </ERROR>
> >
> > If I look at the documentation :
> > http://fr3.php.net/manual/fr/function.date-modify.php
> > it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
> >
> > Do you have any idea about this error (Debian/Apache2) ?
> > Do you have another way to obtain $mois_en_cours1, 2, 3 without
> > DateTime ?
>
> Pre-5.2 you need to explicitly say you want the DateTime class. See
> the note on this page:
> http://fr3.php.net/manual/fr/datetime.installation.php
>
> Also note that it's experimental at the moment and therefore not
> recommended for production usage.
OK. So, my error is normal !!!
Thank you very much.
David.
attached mail follows:
On 16/04/2008, Tony Marston <tony
marston-home.demon.co.uk> wrote:
>
>
> > -----Original Message-----
> > From: Robin Vickery [mailto:robinv
gmail.com]
> > Sent: 16 April 2008 17:23
> > To: Jay Blanchard
> > Cc: Tony Marston; php-general
lists.php.net
> > Subject: Re: [PHP] What is the practical use of "abstract"
> > and "interface"?
> >
> >
> > On 16/04/2008, Jay Blanchard <jblanchard
pocket.com> wrote:
> > > [snip]
> > > > What about encapsulation?
> > >
> > > Interfaces have nothing to do with encapsulation for the
> > smple reason
> > > that I can have encapsulation without using interfaces.
> >
> > Unique use of logic there.
> >
> > By similar reasoning; swimming trunks have nothing to do with
> > swimming for the simple reason that I can swim without trunks.
>
>
> Correct. Encapsulation and polymorphism can be achieved without interfaces,
> therefore interfaces are not necessary.
You've switched positions from "have nothing to do with" to "not
necessary". Prefacing your statement with "Correct" makes it appear
that you're merely re-affirming your original position.
> There is nothing I can achieve with interfaces that I cannot achieve without
> them, therefore they are not necessary. Not only are they not necessary,
> because they do not add value they are totally useless.
There's nothing that you can achieve with PHP5 that you can't achieve
with PHP/FI either. Maybe it's time to scrap all this needless
complexity and return to our roots.
I've already given an example of how formally defined interfaces add
value and you chose to dismiss it on the grounds that there's no need
to check interfaces if you don't use interfaces. *Every* modular
system uses interfaces whether they're formally defined or not.
> Some people seem to use them simply because they are there, or that
> was how they were taught.
Some people don't use them because they weren't there when they
learnt, or they weren't taught how. What's your point?
> > > You are still missing the fundamental point. There is absolutely
> > > nothing I can do WITH interfaces that I cannot do WITHOUT them,
> > > therefore they are redundant.
> >
> > How about compile-time checking that the interface has been
> > correctly implemented?
>
>
> If you don't use interfaces there is no need for such checking.
ok, s/interface/api/ if that makes you happier.
If you need a concrete example, lets say your app has a nifty
plugin system so third-parties can extend it. You have an API for
plugins to register themselves, and each plugin exposes a set of
methods that your application calls when necessary.
If you define an 'interface' for your API and each plugin implements
that interface, then if there's a plugin that doesn't implement it
properly you'll know as soon as the plugin loads.
If you don't formally define the interface, you're not going to know
that the plugin's wrong until the badly implemented method gets
called. And even then it might just introduce a hard to diagnose bug
rather than an obvious failure.
-robin
attached mail follows:
On Thu, Apr 17, 2008 at 3:42 AM, Robin Vickery <robinv
gmail.com> wrote:
> On 16/04/2008, Tony Marston <tony
marston-home.demon.co.uk> wrote:
> >
> >
> > > -----Original Message-----
> > > From: Robin Vickery [mailto:robinv
gmail.com]
> > > Sent: 16 April 2008 17:23
> > > To: Jay Blanchard
> > > Cc: Tony Marston; php-general
lists.php.net
> > > Subject: Re: [PHP] What is the practical use of "abstract"
> > > and "interface"?
> > >
> > >
> > > On 16/04/2008, Jay Blanchard <jblanchard
pocket.com> wrote:
> > > > [snip]
> > > > > What about encapsulation?
> > > >
> > > > Interfaces have nothing to do with encapsulation for the
> > > smple reason
> > > > that I can have encapsulation without using interfaces.
> > >
> > > Unique use of logic there.
> > >
> > > By similar reasoning; swimming trunks have nothing to do with
> > > swimming for the simple reason that I can swim without trunks.
> >
> >
> > Correct. Encapsulation and polymorphism can be achieved without
> interfaces,
> > therefore interfaces are not necessary.
>
> You've switched positions from "have nothing to do with" to "not
> necessary". Prefacing your statement with "Correct" makes it appear
> that you're merely re-affirming your original position.
>
> > There is nothing I can achieve with interfaces that I cannot achieve
> without
> > them, therefore they are not necessary. Not only are they not
> necessary,
> > because they do not add value they are totally useless.
>
> There's nothing that you can achieve with PHP5 that you can't achieve
> with PHP/FI either. Maybe it's time to scrap all this needless
> complexity and return to our roots.
>
> I've already given an example of how formally defined interfaces add
> value and you chose to dismiss it on the grounds that there's no need
> to check interfaces if you don't use interfaces. *Every* modular
> system uses interfaces whether they're formally defined or not.
>
> > Some people seem to use them simply because they are there, or that
> > was how they were taught.
>
> Some people don't use them because they weren't there when they
> learnt, or they weren't taught how. What's your point?
>
> > > > You are still missing the fundamental point. There is absolutely
> > > > nothing I can do WITH interfaces that I cannot do WITHOUT them,
> > > > therefore they are redundant.
> > >
> > > How about compile-time checking that the interface has been
> > > correctly implemented?
> >
> >
> > If you don't use interfaces there is no need for such checking.
>
> ok, s/interface/api/ if that makes you happier.
>
> If you need a concrete example, lets say your app has a nifty
> plugin system so third-parties can extend it. You have an API for
> plugins to register themselves, and each plugin exposes a set of
> methods that your application calls when necessary.
>
> If you define an 'interface' for your API and each plugin implements
> that interface, then if there's a plugin that doesn't implement it
> properly you'll know as soon as the plugin loads.
>
> If you don't formally define the interface, you're not going to know
> that the plugin's wrong until the badly implemented method gets
> called. And even then it might just introduce a hard to diagnose bug
> rather than an obvious failure.
im with you here robin. i think part of the issue w/ the terminology,
interface, API, modular and such is that the terms are all somewhat
abstract. it just so happens that in php there is a concrete term as well.
this can lead to confusion. many times in conversation, its important to
specify particularly what one is speaking about so that others may follow
ones train of thought.
and indeed, in creating an 'api' suppose a set of 'services' based on the
http prtotocol, the HTTP methods (POST, GET, PUT, DELETE [typtically]) and
the values expected to be supplied over those methods comprise and
interface. just like a function. i would also say that the term interface
could be used interchangeably w/ 'method signature'. yes, there are many
things to which the term interface applies it can result in confusion during
technical conversations.
-nathan
attached mail follows:
On Apr 17, 2008, at 5:37 AM, Nathan Nobbe wrote:
> all,
>
> i have heard from various sources that using the & in php can at
> times be
> costly, and therefore, it should not be used when it is not
> needed. for
> example, passing an array by reference because you think youre
> passing the
> actual array is not a good idea. only pass it by reference if a
> modified
> version needs to be handed to the calling code via an actual
> parameter.
> im also wondering about php4 code thats now running under 5; such as
> function &returnObject() ...
> $a =& new SomeClass() ...
> lets suppose, for the sake of arguments, i have my hands on a
> codebase where
> everything actually does count. the code was php4 and is now
> transitioning
> to 5. does anybody know if there would be a performance gain in
> running the
> whole thing through sed to try and strip out the unnecessary &
> characters ?
> any empirical data?
>
> thx,
>
> -nathan
in PHP5 by default Objects are passed by reference and as you can see
at this graph passing array by reference in PHP5 is slower
http://nathan.moxune.com/arrayVsArrayIteratorReport.php
Bojan Tesanovic
http://www.carster.us/
attached mail follows:
On Thu, Apr 17, 2008 at 12:14 AM, Robert Cummings <robert
interjinn.com>
wrote:
> If it's faster, it's faster so that would suggest a performance gain...
> but as many will tell you, and you most likely already know... is the
> gain worth the effort? BTW, rote replacement of references like that,
> may not be a good idea. There are times when you really do want a
> reference to an object... or maybe not... but you or someone else might
> have done it anyways ;)
>
im not sure if its worth the effort yet; thats sortof why im asking about it
on the list. obviously ill risk introduction bugs, which obviously, i dont
want to do... ill have to analyze the regression system as it stands. if
its decent, i might be able to use it as a benchmark utility and to test for
bugs after the mass conversion.
Contrast:
> <?php
>
> $b = new Foo();
> $a = &$b;
> $a = new Fee();
>
> ?>
>
> Versus:
> <?php
>
> $b = new Foo();
> $a = $b;
> $a new Fee();
>
> ?>
>
> In the first $b references the instance of Fee since $a is a reference.
> In the second, $b remains an instance of Foo when $a becomes and
> instance of Fee.
wow, thats a clever example. honestly, i dont think ive ever done that
before myself... but clearly that doesnt mean others havent in this
codebase. thanks for the insight.
-nathan
attached mail follows:
On Thu, Apr 17, 2008 at 4:57 AM, Bojan Tesanovic <btesanovic
gmail.com>
wrote:
> in PHP5 by default Objects are passed by reference and as you can see at
> this graph passing array by reference in PHP5 is slower
> http://nathan.moxune.com/arrayVsArrayIteratorReport.php
wow, thats hilarious, thats my own chart :O ROTFL
im glad somebody else thought something of it ;)
-nathan
attached mail follows:
On Thu, Apr 17, 2008 at 12:00 PM, Nathan Nobbe <quickshiftin
gmail.com> wrote:
> On Thu, Apr 17, 2008 at 4:57 AM, Bojan Tesanovic <btesanovic
gmail.com>
> wrote:
>
>
> > in PHP5 by default Objects are passed by reference and as you can see at
> > this graph passing array by reference in PHP5 is slower
> > http://nathan.moxune.com/arrayVsArrayIteratorReport.php
>
>
> wow, thats hilarious, thats my own chart :O ROTFL
>
> im glad somebody else thought something of it ;)
>
> -nathan
>
I almost spit my water out when I saw that link directed at you. Your
work is famous! ;)
I don't have an actual answer as far as benchmarks go. I've been
converting all of my sites from php4 to 5 over the past 3 months
stripping out &'s as I go. I haven't noticed any differences myself
though. But then again I've been adding in type hints and visibility
too so I'm sure that isn't helping.
I'm always pimping Xdebug, so just remember it will show you where
your real bottlenecks are instead of guessing. *shrug*
attached mail follows:
Can you explain this in more detail for me. Sounds like this code is providing the entry point for
the other hack code.
Greg Bowser wrote:
>> I can sort of figure what is doing; but, I can't figure out what the hacker
>> is using it for.
>
> It will allow him to upload and execute arbitrary code on your server.
> Generally speaking, arbitrary code execution is a bad thing. :).
attached mail follows:
On Thu, Apr 17, 2008 at 8:15 AM, Al <news
ridersite.org> wrote:
> Can you explain this in more detail for me. Sounds like this code is
> providing the entry point for the other hack code.
It probably is, by reading the code from the malicious /tmp files
(/tmp should not allow any execution, by the way). However, more of
an issue is how the exploit code got on there in the first place.
Don't just settle for fixing an issue; solve the problem.
Otherwise, it'll just happen again and again.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
On Apr 17, 2008, at 2:16 AM, Chris wrote:
> Jason Pruim wrote:
>> On Apr 16, 2008, at 5:37 PM, Chris wrote:
>>> Jason Pruim wrote:
>>>> Hi Everyone!
>>>> I'm back with yet another question.... But getting closer to
>>>> sounding like I know what I'm talking about and that's all thanks
>>>> to all of you. A free beer (Or beverage of choice)* for everyone
>>>> who has helped me over the years!
>>>> Here's my question... I have a program, where I want to take out
>>>> the field names in a database table and display them... In other
>>>> words instead of writing:
>>>> $Query ="SELECT First, Last, Middle, Add1 FROM mytable order by
>>>> $order";
>>>> I want to write something more like:
>>>> $Query ="SELECT $FIELDNAMES FROM mytable order by $order";
>>>> So I need to know how to get the field names from the database so
>>>> that I can populate $FIELDNAMES. I played a little bit and it
>>>> looks like I might be able to get what I want by doing 2 queries...
>>>> $QueryFieldNames = "DESCRIBE $table";
>>>> And then some sort of a foreach or maybe a while to populate
>>>> $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if
>>>> I needed to later.
>>>> then I can use my SELECT $FIELDNAMES FROM $table order by $order
>>>> query to do my query...
>>>
>>> If $FIELDNAMES contains all the fields, I have to ask why?
>> What I am trying to accomplish is a customer wants me to add custom
>> fields to their table in my database, I want to use the same code
>> to display the separate fields... In other words right now I have
>> the field names hard coded into my app.. I want to be able to
>> remove the actual field names and have them pulled dynamically from
>> the database, so it doesn't matter if there is 10 fields or 30
>> fields, it will print a header row that contains ALL the field
>> names and format the table properly.
>
> Sure - but you can do it all in one go.
>
> Another approach (which is database independent) is
>
> select * from table limit 0;
>
>
> Had to throw that in the mix :)
Maybe I'm showing my ignorance here in programming... Maybe it's
because I delt with a kid who decided to scream for a good share of
the night and I'm sleep deprived :) But in my current system I have
this:
echo <<<HTML
<div>
<table border="1">
<tr>
<td><a href="?order=a">First Name</a></td>
<td><a href="?order=b">Last Name</a></td>
<td><a href="?order=c">Address 1</a></td>
<td><a href="?order=d">Address 2</a></td>
<td><a href="?order=e">City</a></td>
<td><a href="?order=f">State</a></td>
<td><a href="?order=g">Zip</a></td>
<td><a href="?order=h">Code</a></td>
<td><a href="?order=i">ID #</a></td>
HTML;
while($row = mysqli_fetch_assoc($result)) {
//display the info using heredoc syntac
echo <<<HTML
<tr>
<td>{$row['FName']}</td>
<td>{$row['LName']}</td>
<td>{$row['Add1']}</td>
<td>{$row['Add2']}</td>
<td>{$row['City']}</td>
<td>{$row['State']}</td>
<td>{$row['Zip']}</td>
<td>{$row['XCode']}</td>
<td>{$row['Record']}</td>
HTML;
}
What I want to do is take that first block of code, the one with the
links for sorting, and instead of this: "<td><a href="?order=a">First
Name</a></td>" I want to put something more like this: "<td><a href="?
order=a">$FIELDNAMES[$field{$id}]</a></td>" So I can grab the field
names from the database, instead of hardcoding them into my program.
I think I am sleep deprived because the more I tried to clarify it...
the harder it got for me to understand :)
I need caffeine... Maybe a trip out to the gas station is in order
before I attempt to write more code....
<?PHP while($baby !=sleep){$caffeine = $critical}?>
or something like that :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
On Apr 16, 2008, at 10:55 AM, Richard Heyes wrote:
>> I'm back with yet another question.... But getting closer to
>> sounding like I know what I'm talking about and that's all thanks
>> to all of you. A free beer (Or beverage of choice)* for everyone
>> who has helped me over the years!
>
> I would prefer hard (or soft) cash... :-)
>
>
>> Here's my question... I have a program, where I want to take out
>> the field names in a database table and display them... In other
>> words instead of writing:
>> $Query ="SELECT First, Last, Middle, Add1 FROM mytable order by
>> $order";
>> I want to write something more like:
>> $Query ="SELECT $FIELDNAMES FROM mytable order by $order";
>> So I need to know how to get the field names from the database so
>> that I can populate $FIELDNAMES. I played a little bit and it looks
>> like I might be able to get what I want by doing 2 queries...
>> $QueryFieldNames = "DESCRIBE $table";
>> And then some sort of a foreach or maybe a while to populate
>> $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if I
>> needed to later.
>> then I can use my SELECT $FIELDNAMES FROM $table order by $order
>> query to do my query...
>> Am I on the right path? Way off base? Not even in the ball park?
>> Hopefully it makes sense... Cause it's right on the edge of my
>> knowledge so I'm not totally sure how to ask it right yet :)
>
> You could do it adequately with a DESCRIBE, but there might be
> something that's "better". I would suggest looking through the code
> of my TableEditor:
>
> http://www.phpguru.org/static/TableEditor.html
I took a quick look at it, and quickly realized you know more then
me :P I'll dig into it more today hopefully once the caffeine kicks in
better and I can make a full sentence without having it take me 5
minutes :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
On 17 Apr 2008, at 13:33, Jason Pruim wrote:
> Maybe I'm showing my ignorance here in programming... Maybe it's
> because I delt with a kid who decided to scream for a good share of
> the night and I'm sleep deprived :) But in my current system I have
> this:
>
> echo <<<HTML
>
> <div>
> <table border="1">
> <tr>
> <td><a href="?order=a">First Name</a></td>
> <td><a href="?order=b">Last Name</a></td>
> <td><a href="?order=c">Address 1</a></td>
> <td><a href="?order=d">Address 2</a></td>
> <td><a href="?order=e">City</a></td>
> <td><a href="?order=f">State</a></td>
> <td><a href="?order=g">Zip</a></td>
> <td><a href="?order=h">Code</a></td>
> <td><a href="?order=i">ID #</a></td>
> HTML;
>
> while($row = mysqli_fetch_assoc($result)) {
> //display the info using heredoc syntac
> echo <<<HTML
> <tr>
> <td>{$row['FName']}</td>
> <td>{$row['LName']}</td>
> <td>{$row['Add1']}</td>
> <td>{$row['Add2']}</td>
> <td>{$row['City']}</td>
> <td>{$row['State']}</td>
> <td>{$row['Zip']}</td>
> <td>{$row['XCode']}</td>
> <td>{$row['Record']}</td>
> HTML;
> }
>
> What I want to do is take that first block of code, the one with the
> links for sorting, and instead of this: "<td><a href="?
> order=a">First Name</a></td>" I want to put something more like
> this: "<td><a href="?order=a">$FIELDNAMES[$field{$id}]</a></td>" So
> I can grab the field names from the database, instead of hardcoding
> them into my program.
>
> I think I am sleep deprived because the more I tried to clarify
> it... the harder it got for me to understand :)
echo <<<HTML
<div>
<table border="1">\
HTML;
$first = true;
while ($row = mysqli_fetch_assoc($result)) {
if ($first)
{
echo '<tr>';
foreach (array_keys($row) as $field) {
echo '<td>'.htmlentities($field).'</td>';
}
echo '</tr>';
$first = false;
}
// Output the row here as above
}
-Stut
--
http://stut.net/
attached mail follows:
On Thu, Apr 17, 2008 at 8:38 AM, Jason Pruim <japruim
raoset.com> wrote:
>
> I took a quick look at it, and quickly realized you know more then me :P
> I'll dig into it more today hopefully once the caffeine kicks in better and
> I can make a full sentence without having it take me 5 minutes :)
For the record, it was exactly five minutes.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
Daniel Brown wrote:
> On Thu, Apr 17, 2008 at 8:38 AM, Jason Pruim <japruim
raoset.com> wrote:
>> I took a quick look at it, and quickly realized you know more then me :P
>> I'll dig into it more today hopefully once the caffeine kicks in better and
>> I can make a full sentence without having it take me 5 minutes :)
>
> For the record, it was exactly five minutes.
What was?
--
Richard Heyes
+-----------------------------------------+
|Access SASH through a Windows mapped drive|
| http://www.phpguru.org/sftpdrive |
+-----------------------------------------+
attached mail follows:
> SASH
That should have been SSH of course - seems my spell checker isn't very
technical...
--
Richard Heyes
+-----------------------------------------+
|Access SSH through a Windows mapped drive|
| http://www.phpguru.org/sftpdrive |
+-----------------------------------------+
attached mail follows:
On Thu, Apr 17, 2008 at 10:19 AM, Richard Heyes <richardh
phpguru.org> wrote:
> Daniel Brown wrote:
>
> > On Thu, Apr 17, 2008 at 8:38 AM, Jason Pruim <japruim
raoset.com> wrote:
> >
> > > I took a quick look at it, and quickly realized you know more then me
> :P
> > > I'll dig into it more today hopefully once the caffeine kicks in better
> and
> > > I can make a full sentence without having it take me 5 minutes :)
> > >
> >
> > For the record, it was exactly five minutes.
> >
>
> What was?
The sentence to which he was referring was received in my inbox
exactly five minutes after the prior message, thus validating his
[jocular] statement. ;-P
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
On Apr 17, 2008, at 10:26 AM, Daniel Brown wrote:
> On Thu, Apr 17, 2008 at 10:19 AM, Richard Heyes
> <richardh
phpguru.org> wrote:
>> Daniel Brown wrote:
>>
>>> On Thu, Apr 17, 2008 at 8:38 AM, Jason Pruim <japruim
raoset.com>
>>> wrote:
>>>
>>>> I took a quick look at it, and quickly realized you know more
>>>> then me
>> :P
>>>> I'll dig into it more today hopefully once the caffeine kicks in
>>>> better
>> and
>>>> I can make a full sentence without having it take me 5 minutes :)
>>>>
>>>
>>> For the record, it was exactly five minutes.
>>>
>>
>> What was?
>
> The sentence to which he was referring was received in my inbox
> exactly five minutes after the prior message, thus validating his
> [jocular] statement. ;-P
I timed it that way... Put a few delays into my mailserver just so I
could hit the 5 minute mark :)
Now that the caffeine is kicking in I SHOULD be able to actually
function!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
On Thu, Apr 17, 2008 at 10:24 AM, Richard Heyes <richardh
phpguru.org> wrote:
> > SASH
>
> That should have been SSH of course - seems my spell checker isn't very
> technical...
> +-----------------------------------------+
> |Access SSH through a Windows mapped drive|
> | http://www.phpguru.org/sftpdrive |
> +-----------------------------------------+
Don't feel so bad. Mine insists "nevermind" and "caffeinated"
aren't real words, but then suggests that some technical terms and
acronyms have been suggestions. And since no word in the English
language begins with FT, it defaults to FU.... and yes, my
spell-checker *does* see that as a real word.
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
attached mail follows:
> And since no word in the English language begins with FT
You're forgetting Ftork...
--
Richard Heyes
+-----------------------------------------+
|Access SSH through a Windows mapped drive|
| http://www.phpguru.org/sftpdrive |
+-----------------------------------------+
attached mail follows:
Stut wrote:
> On 17 Apr 2008, at 13:33, Jason Pruim wrote:
>> Maybe I'm showing my ignorance here in programming... Maybe it's
>> because I delt with a kid who decided to scream for a good share of
>> the night and I'm sleep deprived :) But in my current system I have this:
>>
>> echo <<<HTML
>>
>> <div>
>> <table border="1">
>> <tr>
>> <td><a href="?order=a">First Name</a></td>
>> <td><a href="?order=b">Last Name</a></td>
>> <td><a href="?order=c">Address 1</a></td>
>> <td><a href="?order=d">Address 2</a></td>
>> <td><a href="?order=e">City</a></td>
>> <td><a href="?order=f">State</a></td>
>> <td><a href="?order=g">Zip</a></td>
>> <td><a href="?order=h">Code</a></td>
>> <td><a href="?order=i">ID #</a></td>
>> HTML;
>>
>> while($row = mysqli_fetch_assoc($result)) {
>> //display the info using heredoc syntac
>> echo <<<HTML
>> <tr>
>> <td>{$row['FName']}</td>
>> <td>{$row['LName']}</td>
>> <td>{$row['Add1']}</td>
>> <td>{$row['Add2']}</td>
>> <td>{$row['City']}</td>
>> <td>{$row['State']}</td>
>> <td>{$row['Zip']}</td>
>> <td>{$row['XCode']}</td>
>> <td>{$row['Record']}</td>
>> HTML;
>> }
>>
>> What I want to do is take that first block of code, the one with the
>> links for sorting, and instead of this: "<td><a href="?order=a">First
>> Name</a></td>" I want to put something more like this: "<td><a
>> href="?order=a">$FIELDNAMES[$field{$id}]</a></td>" So I can grab the
>> field names from the database, instead of hardcoding them into my
>> program.
>>
>> I think I am sleep deprived because the more I tried to clarify it...
>> the harder it got for me to understand :)
>
> echo <<<HTML
> <div>
> <table border="1">\
> HTML;
>
> $first = true;
> while ($row = mysqli_fetch_assoc($result)) {
> if ($first)
> {
> echo '<tr>';
> foreach (array_keys($row) as $field) {
> echo '<td>'.htmlentities($field).'</td>';
> }
> echo '</tr>';
> $first = false;
> }
>
> // Output the row here as above
> }
>
> -Stut
>
Very good example, but I would remove data retrieval from the display of data.
<?php
$dataSet = array();
while ($row = mysqli_fetch_assoc($result)) {
$dataSet[] = $row;
}
# do some other stuff
# now display
# Check to see if there is anything in the dataSet
if ( count($dataSet) > 0 ) {
echo '<table>';
# Get the names of the columns from the first result set
$headers = array_keys($dataSet[0]);
# Print the column names
echo '<tr>';
foreach ( $headers AS $column_name ) {
echo "<th>{$column_name}</th>";
}
echo '</tr>';
# Now print your data
foreach ( $dataSet AS $row ) {
echo <<<ROW
<tr>
<td>{$row['FName']}</td>
<td>{$row['LName']}</td>
<td>{$row['Add1']}</td>
<td>{$row['Add2']}</td>
<td>{$row['City']}</td>
<td>{$row['State']}</td>
<td>{$row['Zip']}</td>
<td>{$row['XCode']}</td>
<td>{$row['Record']}</td>
</tr>
ROW;
}
echo '</table>';
}
?>
--
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
attached mail follows:
On Apr 17, 2008, at 11:14 AM, Jim Lucas wrote:
> Stut wrote:
>> On 17 Apr 2008, at 13:33, Jason Pruim wrote:
>>> Maybe I'm showing my ignorance here in programming... Maybe it's
>>> because I delt with a kid who decided to scream for a good share
>>> of the night and I'm sleep deprived :) But in my current system I
>>> have this:
>>>
>>> echo <<<HTML
>>>
>>> <div>
>>> <table border="1">
>>> <tr>
>>> <td><a href="?order=a">First Name</a></td>
>>> <td><a href="?order=b">Last Name</a></td>
>>> <td><a href="?order=c">Address 1</a></td>
>>> <td><a href="?order=d">Address 2</a></td>
>>> <td><a href="?order=e">City</a></td>
>>> <td><a href="?order=f">State</a></td>
>>> <td><a href="?order=g">Zip</a></td>
>>> <td><a href="?order=h">Code</a></td>
>>> <td><a href="?order=i">ID #</a></td>
>>> HTML;
>>>
>>> while($row = mysqli_fetch_assoc($result)) {
>>> //display the info using heredoc syntac
>>> echo <<<HTML
>>> <tr>
>>> <td>{$row['FName']}</td>
>>> <td>{$row['LName']}</td>
>>> <td>{$row['Add1']}</td>
>>> <td>{$row['Add2']}</td>
>>> <td>{$row['City']}</td>
>>> <td>{$row['State']}</td>
>>> <td>{$row['Zip']}</td>
>>> <td>{$row['XCode']}</td>
>>> <td>{$row['Record']}</td>
>>> HTML;
>>> }
>>>
>>> What I want to do is take that first block of code, the one with
>>> the links for sorting, and instead of this: "<td><a href="?
>>> order=a">First Name</a></td>" I want to put something more like
>>> this: "<td><a href="?order=a">$FIELDNAMES[$field{$id}]</a></td>"
>>> So I can grab the field names from the database, instead of
>>> hardcoding them into my program.
>>>
>>> I think I am sleep deprived because the more I tried to clarify
>>> it... the harder it got for me to understand :)
>> echo <<<HTML
>> <div>
>> <table border="1">\
>> HTML;
>> $first = true;
>> while ($row = mysqli_fetch_assoc($result)) {
>> if ($first)
>> {
>> echo '<tr>';
>> foreach (array_keys($row) as $field) {
>> echo '<td>'.htmlentities($field).'</td>';
>> }
>> echo '</tr>';
>> $first = false;
>> }
>> // Output the row here as above
>> }
>> -Stut
>
> Very good example, but I would remove data retrieval from the
> display of data.
>
> <?php
>
> $dataSet = array();
> while ($row = mysqli_fetch_assoc($result)) {
> $dataSet[] = $row;
> }
>
> # do some other stuff
>
> # now display
> # Check to see if there is anything in the dataSet
> if ( count($dataSet) > 0 ) {
>
> echo '<table>';
>
> # Get the names of the columns from the first result set
> $headers = array_keys($dataSet[0]);
>
> # Print the column names
> echo '<tr>';
> foreach ( $headers AS $column_name ) {
> echo "<th>{$column_name}</th>";
> }
> echo '</tr>';
>
> # Now print your data
> foreach ( $dataSet AS $row ) {
> echo <<<ROW
> <tr>
> <td>{$row['FName']}</td>
> <td>{$row['LName']}</td>
> <td>{$row['Add1']}</td>
> <td>{$row['Add2']}</td>
> <td>{$row['City']}</td>
> <td>{$row['State']}</td>
> <td>{$row['Zip']}</td>
> <td>{$row['XCode']}</td>
> <td>{$row['Record']}</td>
> </tr>
> ROW;
> }
> echo '</table>';
> }
>
> ?>
Both ideas worked great... Thank you!
Now I do still have one question, I decided that what Jim put up
worked a little bit better for me so I'm going off of his code, what I
want to do now though, is take this code:
foreach ( $dataSet AS $row ) {
echo <<<ROW
<tr>
<td>{$row['FName']}</td>
<td>{$row['LName']}</td>
<td>{$row['Add1']}</td>
<td>{$row['Add2']}</td>
<td>{$row['City']}</td>
<td>{$row['State']}</td>
<td>{$row['Zip']}</td>
<td>{$row['XCode']}</td>
<td>{$row['Record']}</td>
</tr>
ROW;
}
And turn it into some kind of a loop that would pull the info
dynamically so I can have something more like this:
<?PHP
while($dataSet <= $num_rows) {
//print dynamic fields based off of field names
echo <<<ROW
<tr>
<td>$dataSet['$field']</td>
</tr>
ROW;
}
?>
And what would print on the page would be something along the lines of:
<?PHP
echo <<<TEST
<tr>
<td>Jason</td>
<td>Pruim</td>
<td>My Address</td>
<td>My Other Address</td>
</tr>
TEST;
?>
Etc. Etc. Etc. I'm trying to avoid hardcoding things like field names
so that I can use this software for multiple customers without having
to completely customize it for everyone since so many parts will be
the same.
Maybe though I'm trying to abstract the wrong part of the program... I
could do it to a few other parts and just customize this one...
Need to think about that.
Any ideas are greatly appreciated :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
Jason Pruim wrote:
>
> On Apr 17, 2008, at 11:14 AM, Jim Lucas wrote:
>> Stut wrote:
>>> On 17 Apr 2008, at 13:33, Jason Pruim wrote:
>>>> Maybe I'm showing my ignorance here in programming... Maybe it's
>>>> because I delt with a kid who decided to scream for a good share of
>>>> the night and I'm sleep deprived :) But in my current system I have
>>>> this:
>>>>
>>>> echo <<<HTML
>>>>
>>>> <div>
>>>> <table border="1">
>>>> <tr>
>>>> <td><a href="?order=a">First Name</a></td>
>>>> <td><a href="?order=b">Last Name</a></td>
>>>> <td><a href="?order=c">Address 1</a></td>
>>>> <td><a href="?order=d">Address 2</a></td>
>>>> <td><a href="?order=e">City</a></td>
>>>> <td><a href="?order=f">State</a></td>
>>>> <td><a href="?order=g">Zip</a></td>
>>>> <td><a href="?order=h">Code</a></td>
>>>> <td><a href="?order=i">ID #</a></td>
>>>> HTML;
>>>>
>>>> while($row = mysqli_fetch_assoc($result)) {
>>>> //display the info using heredoc syntac
>>>> echo <<<HTML
>>>> <tr>
>>>> <td>{$row['FName']}</td>
>>>> <td>{$row['LName']}</td>
>>>> <td>{$row['Add1']}</td>
>>>> <td>{$row['Add2']}</td>
>>>> <td>{$row['City']}</td>
>>>> <td>{$row['State']}</td>
>>>> <td>{$row['Zip']}</td>
>>>> <td>{$row['XCode']}</td>
>>>> <td>{$row['Record']}</td>
>>>> HTML;
>>>> }
>>>>
>>>> What I want to do is take that first block of code, the one with the
>>>> links for sorting, and instead of this: "<td><a
>>>> href="?order=a">First Name</a></td>" I want to put something more
>>>> like this: "<td><a
>>>> href="?order=a">$FIELDNAMES[$field{$id}]</a></td>" So I can grab the
>>>> field names from the database, instead of hardcoding them into my
>>>> program.
>>>>
>>>> I think I am sleep deprived because the more I tried to clarify
>>>> it... the harder it got for me to understand :)
>>> echo <<<HTML
>>> <div>
>>> <table border="1">\
>>> HTML;
>>> $first = true;
>>> while ($row = mysqli_fetch_assoc($result)) {
>>> if ($first)
>>> {
>>> echo '<tr>';
>>> foreach (array_keys($row) as $field) {
>>> echo '<td>'.htmlentities($field).'</td>';
>>> }
>>> echo '</tr>';
>>> $first = false;
>>> }
>