php-general Digest 19 Jan 2010 02:20:30 -0000 Issue 6545
Topics (messages 301180 through 301201):
Re: RSYNC - who knows more?
301180 by: Richard
301183 by: Michael Kubler
301184 by: Jens Geier
Zend debugger doesn't work
301181 by: Ali Asghar Toraby Parizy
integrating shipping with shopping cart site - OT
301182 by: Angelo Zanetti
64 Bit IIS 6 ( 32 Bit mode ) + 32Bit php connect with MS-SQL Server
301185 by: Edward S.P. Leong
301189 by: Richard Quadling
301201 by: edwardspl.ita.org.mo
Notices flooding logs with fastcgi
301186 by: Max Zimmermann
301187 by: Ashley Sheridan
301188 by: Max Zimmermann
301190 by: Richard Quadling
301191 by: Robert Cummings
301193 by: Max Zimmermann
301194 by: Max Zimmermann
Casting objects.
301192 by: Richard Quadling
301197 by: Shawn McKenzie
301199 by: Shawn McKenzie
301200 by: Shawn McKenzie
intermittent failure of php date
301195 by: John Corry
301196 by: John Corry
301198 by: Ashley Sheridan
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Hi,
> yes i see the links to the mailing lists, but i can not access them.
Ask away then. Someone may be able to help you. I've used it a little
before in the past to synchronise dev and live boxes.
--
Richard Heyes
HTML5 canvas graphing: RGraph - http://www.rgraph.net (updated 16th January)
Lots of PHP and Javascript code - http://www.phpguru.org
--- End Message ---
--- Begin Message ---
What is it you want to do?
Do you want to create a client for RSYNC, or maybe rsync to AmazonS3
<http://jeremy.zawodny.com/blog/archives/007641.html> (which is
admittedly hard), or maybe use something like rsnapshot
<http://www.rsnapshot.org/> to have rsync + snapshot functionality,
which is great when you get a whole heap of corrupt data that gets
sync'd across, you can go back to an old snapshot instead of loosing
everything.
--
Michael Kubler
*G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>
Mobile : 0433483008
I believe in a better world. I support the Zeitgeist Movement
<http://www.zeitgeistsa.com>.
Jens Geier wrote:
Hello,
as sugestet i tried backup by using RSYNC.
It is working fine.
But i have some more Questions for this software.
Is here some one that can help me with it?
Kind Regards
Jens Geier
--- End Message ---
--- Begin Message ---
Hello Michael,
usualy i like to make a backup of some Paths of my Laptop.
So i think a rsnapshot should be a good idea.
So i will have a look to your second Link you provide.
Kind Regards
Jens Geier
"Michael Kubler" <[email protected]> schrieb im Newsbeitrag
news:[email protected]...
> What is it you want to do?
> Do you want to create a client for RSYNC, or maybe rsync to AmazonS3
> <http://jeremy.zawodny.com/blog/archives/007641.html> (which is
> admittedly hard), or maybe use something like rsnapshot
> <http://www.rsnapshot.org/> to have rsync + snapshot functionality,
> which is great when you get a whole heap of corrupt data that gets
> sync'd across, you can go back to an old snapshot instead of loosing
> everything.
>
> Michael Kubler
> *G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>
> Mobile : 0433483008
>
> I believe in a better world. I support the Zeitgeist Movement
> <http://www.zeitgeistsa.com>.
>
>
> Jens Geier wrote:
>> Hello,
>>
>> as sugestet i tried backup by using RSYNC.
>> It is working fine.
>>
>> But i have some more Questions for this software.
>>
>> Is here some one that can help me with it?
>>
>> Kind Regards
>> Jens Geier
>
--- End Message ---
--- Begin Message ---
Hi
I have installed php 5.3.1 (with thread safety = on) recently And I
tried to install zend debugger yesterday. I downloaded zend debugger
extension from http://downloads.zend.com/pdt/server-debugger/
But I didn't find dll module for 5.3.x release. So I tried dll file in
5_2_x_comp folder. When I start Apache, I have a line in log file that
says:
Apache/2.2.14 (Win32) PHP/5.3.1 configured -- resuming normal operations
And phpinfo() says nothing about debugger module! What do you think
about this thing? I haven't seen any error, But there is no debug
session!
Should I wait for 5.3.x release of zend debugger?
--- End Message ---
--- Begin Message ---
Hi all,
We are about to start a new project. Custom written shopping cart - quite
simple actually. However we have a concern when it comes to calculating the
shipping cost for an order.
For each product we can determine the base cost based on weight, therefore
we can determine the total weight of an order.
However we are struggling to determine how to calculate the shipping based
on where the delivery is going.
In terms of DB and PHP would the best way to calculate it be done by having
a list of countries to ship to and a rate for each? Then you can apply the
rate to the current order (calculate according to the order weight).
Problems arise when shipping to different parts of a country EG:
New York vs California (quite far apart). Perhaps we should have a list of
cities but that could be massive?
I know there is a PHP class / system that integrates with UPS but I don't
think the client is going to use UPS.
Perhaps you can tell me how you have handled this issue in the past.
Apologies if it is slightly off topic but it does still relate to PHP
indirectly.
Thanks in advance.
Angelo
http://www.wapit.co.za
http://www.elemental.co.za
--- End Message ---
--- Begin Message ---
Dear All,
I had config the php.ini as the following :
extension=php_mssql.dll
Then run the cli "iisreset" and reboot the web server machine...
After that, there is NO any MS-SQL within the phpinfo()...
So, would you mind to help more ?
Thanks !
Edward.
--- End Message ---
--- Begin Message ---
2010/1/18 Edward S.P. Leong <[email protected]>:
> Dear All,
>
> I had config the php.ini as the following :
> extension=php_mssql.dll
>
> Then run the cli "iisreset" and reboot the web server machine...
> After that, there is NO any MS-SQL within the phpinfo()...
> So, would you mind to help more ?
>
> Thanks !
>
> Edward.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
1 - Can you confirm that the ini file you are editing is the one that
is reported in phpinfo() as the file being used?
2 - At a command prompt, change directory to your PHP installation and type ...
php -m
See if you have any errors being reported.
If the INI file is in an unusual location, then use ...
php -c <location_of_php.ini file> -m
instead; e.g.
php -c D:\PHP\INI\php-cli.ini -m
php -c C:\windows\php-isapi.ini -m
etc.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
引述 Richard Quadling <[email protected]>:
1 - Can you confirm that the ini file you are editing is the one that
is reported in phpinfo() as the file being used?
Yes, BUT there is no MSSQL info of it...
2 - At a command prompt, change directory to your PHP installation
and type ...
php -m
See if you have any errors being reported.
If the INI file is in an unusual location, then use ...
php -c <location_of_php.ini file> -m
T:\php5>php -c t:\php5\php.ini -m
PHP Warning: PHP Startup: Unable to load dynamic library
'T:\PHP5\ext\php_mssql
.dll' - The specified module could not be found.
in Unknown on line 0
[PHP Modules]
bcmath
calendar
com_dotnet
ctype
date
dom
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mcrypt
mysql
odbc
pcre
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
T:\php5\ext>dir php_mssql.dll
Volume in drive T is Data
Volume Serial Number is DC85-706F
Directory of T:\php5\ext
2009/12/16 下午 05:06 49,232 php_mssql.dll
1 File(s) 49,232 bytes
0 Dir(s) 52,215,365,632 bytes free
T:\php5\ext>
BTW : when running the cli of php -c t:\php5\php.ini -m, the system
prompt me there is no "MSVCR71.dll" found...
So, how can I install the dll file for test ( php -m ) again ?
Thanks !
Edward.
----------------------------------------------------------------
ITA Web Site : http://www.ita.org.mo
E-mail Address : [email protected]
--- End Message ---
--- Begin Message ---
Hello everybody,
I have chosen this list because my problem is related to one particular
style of php installation. At least I think so.
I'm running php 5.2.11 and plesk 9.2.3, php through fastCGI.
My problem is that, since error_log is unset, php passes on any errors
to the webserver (-handler). This fills up my logs with hundreds of
MBytes of Notices every day, even though error_reporting is set to 6135
(notices shouldn't be logged).
So error_reporting appears to be ignored when error_log is unset and php
is run through fastcgi. Any idea how I can fix that?
I unfortunately can't change error_log to the appropriate path, because
the fastcgi user doesn't have access to the log directory...
Here is an example log:
[Mon Oct 26 00:57:52 2009] [warn] mod_fcgid: stderr: PHP Notice:
Undefined offset: 1 in
/srv/www/vhosts/XXXX/httpdocs/
x3/inc/shopstat_functions.inc.php on line 82
Thanks so much in advance,
--
Cheers,
Max
GNU/Linux - User #477672
PGP: 0x6C29B594
--- End Message ---
--- Begin Message ---
On Mon, 2010-01-18 at 12:20 +0000, Max Zimmermann wrote:
> Hello everybody,
>
> I have chosen this list because my problem is related to one particular
> style of php installation. At least I think so.
>
> I'm running php 5.2.11 and plesk 9.2.3, php through fastCGI.
>
> My problem is that, since error_log is unset, php passes on any errors
> to the webserver (-handler). This fills up my logs with hundreds of
> MBytes of Notices every day, even though error_reporting is set to 6135
> (notices shouldn't be logged).
> So error_reporting appears to be ignored when error_log is unset and php
> is run through fastcgi. Any idea how I can fix that?
> I unfortunately can't change error_log to the appropriate path, because
> the fastcgi user doesn't have access to the log directory...
>
> Here is an example log:
> [Mon Oct 26 00:57:52 2009] [warn] mod_fcgid: stderr: PHP Notice:
> Undefined offset: 1 in
> /srv/www/vhosts/XXXX/httpdocs/
> x3/inc/shopstat_functions.inc.php on line 82
>
> Thanks so much in advance,
> --
> Cheers,
>
> Max
>
>
> GNU/Linux - User #477672
> PGP: 0x6C29B594
I believe that the reporting level is only used for errors displayed in
the browser window, not to the ones that are logged.
If you're having your error logs fill up with errors, this isn't an
issue with PHP but the coder! It is obviously more than a few errors,
unless your website has millions of visitors each day triggering the
same error, but which is more likely a scenario?!
I'd advise fixing those errors, even the warnings, as warnings are often
a prelude to a logic problem somewhere in the code.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
2010/1/18 Ashley Sheridan <[email protected]>
> On Mon, 2010-01-18 at 12:20 +0000, Max Zimmermann wrote:
>
> Hello everybody,
>
> I have chosen this list because my problem is related to one particular
> style of php installation. At least I think so.
>
> I'm running php 5.2.11 and plesk 9.2.3, php through fastCGI.
>
> My problem is that, since error_log is unset, php passes on any errors
> to the webserver (-handler). This fills up my logs with hundreds of
> MBytes of Notices every day, even though error_reporting is set to 6135
> (notices shouldn't be logged).
> So error_reporting appears to be ignored when error_log is unset and php
> is run through fastcgi. Any idea how I can fix that?
> I unfortunately can't change error_log to the appropriate path, because
> the fastcgi user doesn't have access to the log directory...
>
> Here is an example log:
> [Mon Oct 26 00:57:52 2009] [warn] mod_fcgid: stderr: PHP Notice:
> Undefined offset: 1 in
> /srv/www/vhosts/XXXX/httpdocs/
> x3/inc/shopstat_functions.inc.php on line 82
>
> Thanks so much in advance,
> --
> Cheers,
>
> Max
>
>
> GNU/Linux - User #477672
> PGP: 0x6C29B594
>
>
> I believe that the reporting level is only used for errors displayed in the
> browser window, not to the ones that are logged.
>
> If you're having your error logs fill up with errors, this isn't an issue
> with PHP but the coder! It is obviously more than a few errors, unless your
> website has millions of visitors each day triggering the same error, but
> which is more likely a scenario?!
>
> I'd advise fixing those errors, even the warnings, as warnings are often a
> prelude to a logic problem somewhere in the code.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
Hey Ash,
thanks for your reply.
I know this is a coding issue, and xt:commerce always produces loads of
notices. That said, I think the error_reporting setting does apply to
logging when mod_php is used. I could be wrong though.
But even fixing the whole of xt:commerce code to be notice free (which would
be rediculously much work) doesn't solve the problem. Whenever anyone is
installing something new on his website lying on this server, I'm gonna have
the same problem again. I can't spend my whole time basically reviewing code
that someone runs on the server... I think that's understandable ;)
So I'm afraid I'm gonna need some other ideas :(
Thanks again,
Max
--- End Message ---
--- Begin Message ---
2010/1/18 Max Zimmermann <[email protected]>:
> 2010/1/18 Ashley Sheridan <[email protected]>
>
>> On Mon, 2010-01-18 at 12:20 +0000, Max Zimmermann wrote:
>>
>> Hello everybody,
>>
>> I have chosen this list because my problem is related to one particular
>> style of php installation. At least I think so.
>>
>> I'm running php 5.2.11 and plesk 9.2.3, php through fastCGI.
>>
>> My problem is that, since error_log is unset, php passes on any errors
>> to the webserver (-handler). This fills up my logs with hundreds of
>> MBytes of Notices every day, even though error_reporting is set to 6135
>> (notices shouldn't be logged).
>> So error_reporting appears to be ignored when error_log is unset and php
>> is run through fastcgi. Any idea how I can fix that?
>> I unfortunately can't change error_log to the appropriate path, because
>> the fastcgi user doesn't have access to the log directory...
>>
>> Here is an example log:
>> [Mon Oct 26 00:57:52 2009] [warn] mod_fcgid: stderr: PHP Notice:
>> Undefined offset: 1 in
>> /srv/www/vhosts/XXXX/httpdocs/
>> x3/inc/shopstat_functions.inc.php on line 82
>>
>> Thanks so much in advance,
>> --
>> Cheers,
>>
>> Max
>>
>>
>> GNU/Linux - User #477672
>> PGP: 0x6C29B594
>>
>>
>> I believe that the reporting level is only used for errors displayed in the
>> browser window, not to the ones that are logged.
>>
>> If you're having your error logs fill up with errors, this isn't an issue
>> with PHP but the coder! It is obviously more than a few errors, unless your
>> website has millions of visitors each day triggering the same error, but
>> which is more likely a scenario?!
>>
>> I'd advise fixing those errors, even the warnings, as warnings are often a
>> prelude to a logic problem somewhere in the code.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
> Hey Ash,
>
> thanks for your reply.
> I know this is a coding issue, and xt:commerce always produces loads of
> notices. That said, I think the error_reporting setting does apply to
> logging when mod_php is used. I could be wrong though.
>
> But even fixing the whole of xt:commerce code to be notice free (which would
> be rediculously much work) doesn't solve the problem. Whenever anyone is
> installing something new on his website lying on this server, I'm gonna have
> the same problem again. I can't spend my whole time basically reviewing code
> that someone runs on the server... I think that's understandable ;)
> So I'm afraid I'm gonna need some other ideas :(
>
> Thanks again,
>
> Max
>
Don't log the errors!
Let them go to php's normal error log. If you can have a per-site
setup, then log them per site and pass them to the coder/owner to fix.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
On Mon, 2010-01-18 at 12:20 +0000, Max Zimmermann wrote:
Hello everybody,
I have chosen this list because my problem is related to one particular
style of php installation. At least I think so.
I'm running php 5.2.11 and plesk 9.2.3, php through fastCGI.
My problem is that, since error_log is unset, php passes on any errors
to the webserver (-handler). This fills up my logs with hundreds of
MBytes of Notices every day, even though error_reporting is set to 6135
(notices shouldn't be logged).
So error_reporting appears to be ignored when error_log is unset and php
is run through fastcgi. Any idea how I can fix that?
I unfortunately can't change error_log to the appropriate path, because
the fastcgi user doesn't have access to the log directory...
Here is an example log:
[Mon Oct 26 00:57:52 2009] [warn] mod_fcgid: stderr: PHP Notice:
Undefined offset: 1 in
/srv/www/vhosts/XXXX/httpdocs/
x3/inc/shopstat_functions.inc.php on line 82
Thanks so much in advance,
--
Cheers,
Max
GNU/Linux - User #477672
PGP: 0x6C29B594
I believe that the reporting level is only used for errors displayed in
the browser window, not to the ones that are logged.
The error_reporting setting controls both logged and displayed errors.
@Max ... is it possible your application is resetting error_reporting
after you set it manually? Maybe try a recursive grep on the source tree
for error_reporting.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
2010/1/18 Richard Quadling <[email protected]>
> 2010/1/18 Max Zimmermann <[email protected]>:
> > 2010/1/18 Ashley Sheridan <[email protected]>
> >
> >> On Mon, 2010-01-18 at 12:20 +0000, Max Zimmermann wrote:
> >>
> >> Hello everybody,
> >>
> >> I have chosen this list because my problem is related to one particular
> >> style of php installation. At least I think so.
> >>
> >> I'm running php 5.2.11 and plesk 9.2.3, php through fastCGI.
> >>
> >> My problem is that, since error_log is unset, php passes on any errors
> >> to the webserver (-handler). This fills up my logs with hundreds of
> >> MBytes of Notices every day, even though error_reporting is set to 6135
> >> (notices shouldn't be logged).
> >> So error_reporting appears to be ignored when error_log is unset and php
> >> is run through fastcgi. Any idea how I can fix that?
> >> I unfortunately can't change error_log to the appropriate path, because
> >> the fastcgi user doesn't have access to the log directory...
> >>
> >> Here is an example log:
> >> [Mon Oct 26 00:57:52 2009] [warn] mod_fcgid: stderr: PHP Notice:
> >> Undefined offset: 1 in
> >> /srv/www/vhosts/XXXX/httpdocs/
> >> x3/inc/shopstat_functions.inc.php on line 82
> >>
> >> Thanks so much in advance,
> >> --
> >> Cheers,
> >>
> >> Max
> >>
> >>
> >> GNU/Linux - User #477672
> >> PGP: 0x6C29B594
> >>
> >>
> >> I believe that the reporting level is only used for errors displayed in
> the
> >> browser window, not to the ones that are logged.
> >>
> >> If you're having your error logs fill up with errors, this isn't an
> issue
> >> with PHP but the coder! It is obviously more than a few errors, unless
> your
> >> website has millions of visitors each day triggering the same error, but
> >> which is more likely a scenario?!
> >>
> >> I'd advise fixing those errors, even the warnings, as warnings are often
> a
> >> prelude to a logic problem somewhere in the code.
> >>
> >> Thanks,
> >> Ash
> >> http://www.ashleysheridan.co.uk
> >>
> >>
> >>
> > Hey Ash,
> >
> > thanks for your reply.
> > I know this is a coding issue, and xt:commerce always produces loads of
> > notices. That said, I think the error_reporting setting does apply to
> > logging when mod_php is used. I could be wrong though.
> >
> > But even fixing the whole of xt:commerce code to be notice free (which
> would
> > be rediculously much work) doesn't solve the problem. Whenever anyone is
> > installing something new on his website lying on this server, I'm gonna
> have
> > the same problem again. I can't spend my whole time basically reviewing
> code
> > that someone runs on the server... I think that's understandable ;)
> > So I'm afraid I'm gonna need some other ideas :(
> >
> > Thanks again,
> >
> > Max
> >
>
> Don't log the errors!
>
> Let them go to php's normal error log. If you can have a per-site
> setup, then log them per site and pass them to the coder/owner to fix.
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
Hey Richard,
thanks for you reply. Yes, that was what I was thinking about. And after a
bit of thinking, this is what I'm going to do. Everything else seems
pointless :)
Thanks for the tip!
Max
--- End Message ---
--- Begin Message ---
2010/1/18 Robert Cummings <[email protected]>
>
>
> Ashley Sheridan wrote:
>
>> On Mon, 2010-01-18 at 12:20 +0000, Max Zimmermann wrote:
>>
>> Hello everybody,
>>>
>>> I have chosen this list because my problem is related to one particular
>>> style of php installation. At least I think so.
>>>
>>> I'm running php 5.2.11 and plesk 9.2.3, php through fastCGI.
>>>
>>> My problem is that, since error_log is unset, php passes on any errors
>>> to the webserver (-handler). This fills up my logs with hundreds of
>>> MBytes of Notices every day, even though error_reporting is set to 6135
>>> (notices shouldn't be logged).
>>> So error_reporting appears to be ignored when error_log is unset and php
>>> is run through fastcgi. Any idea how I can fix that?
>>> I unfortunately can't change error_log to the appropriate path, because
>>> the fastcgi user doesn't have access to the log directory...
>>>
>>> Here is an example log:
>>> [Mon Oct 26 00:57:52 2009] [warn] mod_fcgid: stderr: PHP Notice:
>>> Undefined offset: 1 in
>>> /srv/www/vhosts/XXXX/httpdocs/
>>> x3/inc/shopstat_functions.inc.php on line 82
>>>
>>> Thanks so much in advance,
>>> --
>>> Cheers,
>>>
>>> Max
>>>
>>>
>>> GNU/Linux - User #477672
>>> PGP: 0x6C29B594
>>>
>>
>>
>> I believe that the reporting level is only used for errors displayed in
>> the browser window, not to the ones that are logged.
>>
>
> The error_reporting setting controls both logged and displayed errors.
>
> @Max ... is it possible your application is resetting error_reporting after
> you set it manually? Maybe try a recursive grep on the source tree for
> error_reporting.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
Hey Rob,
thanks for your reply. No, unfortunately this seems to be a problem with
fastCGI, since phpinfo() run somewhere inside the script still says that the
error_reporting is set correctly. It just doesn't seem have any influence
when errors are logged by the SAPI handler.
But since this appears to be not easily changeable right now, I'm going to
go with Richard's idea.
Thanks all of you for helping! :)
Best,
Max
--- End Message ---
--- Begin Message ---
Hello.
I've got an object via odbc_fetch_object (which is of stdClass).
I have an class structuresRemovalReason.
I want to cast the response of odbc_fetch_object to structuresRemovalReason.
The only way I can see of doing this is to not use odbc_fetch_object,
but odbc_fetch_assoc and then iterate the array and populate a new
structuresRemovalReason.
Or an I missing a trick. I'm pretty sure I am.
Regards,
Richard Quadling.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Richard Quadling wrote:
> Hello.
>
> I've got an object via odbc_fetch_object (which is of stdClass).
>
> I have an class structuresRemovalReason.
>
> I want to cast the response of odbc_fetch_object to structuresRemovalReason.
>
> The only way I can see of doing this is to not use odbc_fetch_object,
> but odbc_fetch_assoc and then iterate the array and populate a new
> structuresRemovalReason.
>
> Or an I missing a trick. I'm pretty sure I am.
>
> Regards,
>
> Richard Quadling.
>
Something like this in your class or another class may work (not
tested). You might even fetch an array and send it to this method. I
think either should work:
class structuresRemovalReason {
static public function cast(structuresRemovalReason $object) {
return $object;
}
}
$row = structuresRemovalReason::cast(odbc_fetch_object($result));
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Richard Quadling wrote:
>> Hello.
>>
>> I've got an object via odbc_fetch_object (which is of stdClass).
>>
>> I have an class structuresRemovalReason.
>>
>> I want to cast the response of odbc_fetch_object to structuresRemovalReason.
>>
>> The only way I can see of doing this is to not use odbc_fetch_object,
>> but odbc_fetch_assoc and then iterate the array and populate a new
>> structuresRemovalReason.
>>
>> Or an I missing a trick. I'm pretty sure I am.
>>
>> Regards,
>>
>> Richard Quadling.
>>
>
> Something like this in your class or another class may work (not
> tested). You might even fetch an array and send it to this method. I
> think either should work:
>
> class structuresRemovalReason {
>
> static public function cast(structuresRemovalReason $object) {
> return $object;
> }
> }
>
> $row = structuresRemovalReason::cast(odbc_fetch_object($result));
>
Never mind, that was stupid. I saw that somewhere before, but obviously
it doesn't work.
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
>>
> Never mind, that was stupid. I saw that somewhere before, but obviously
> it doesn't work.
>
I found some code, maybe I redeem myself?
static public function cast(&$object, $class=__CLASS__){
if(class_exists($class)) {
$object = unserialize(
preg_replace('/^O:[0-9]+:"[^"]+":/i',
'O:'.strlen($class).':"'.$class.'":',
serialize($object)));
}
}
$row = odbc_fetch_object($result);
structuresRemovalReason::cast($row);
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
I maintain a site that is generating some strange behavior...
It's a custom built event registration app.
Events have event_dates that are stored in the MySQL db.
This code retrieves the event title and event date for display on the
registration acknowledgment page:
$q2 = "SELECT title, event_date, DATE_FORMAT(event_date, '%M %d, %Y') AS
formatted_event_date FROM events WHERE id =" . $eid . ";";
$result = mysql_query($q2);
if ($result) {
$row = mysql_fetch_array($result);
$title = $row['title'];
if(strtotime($row['event_date'])) {
$event_date = date("F m, Y", strtotime($row['event_date']));
} else {
$event_date = $row['formatted_event_date'];
}
Sometimes, it doesn't work.
Every 3rd or 4th registration notification email comes through with an empty
value for event_date.
There are no other references to the variable $event_date.
It works most of the time.
There's no pattern I can see. I even tried to force it to show a date by
selecting a formatted date and displaying that if the original programmer's
strtotime failed.
Where do you look for help with intermittent failures of a date field in the
DB?
--
John Corry
PHP developer - 3by400, Inc
http://www.3by400.com
--- End Message ---
--- Begin Message ---
The field in the DB is defined as type date.
I've had several event registrations for an upcoming event come through. THe
event date is '2010-01-27'.
2 of the 5 event registrations contained empty values for the date.
wtf?
On Mon, Jan 18, 2010 at 10:23 AM, John Corry <[email protected]> wrote:
> I maintain a site that is generating some strange behavior...
>
> It's a custom built event registration app.
>
> Events have event_dates that are stored in the MySQL db.
>
> This code retrieves the event title and event date for display on the
> registration acknowledgment page:
>
> $q2 = "SELECT title, event_date, DATE_FORMAT(event_date, '%M %d, %Y') AS
> formatted_event_date FROM events WHERE id =" . $eid . ";";
> $result = mysql_query($q2);
> if ($result) {
> $row = mysql_fetch_array($result);
> $title = $row['title'];
>
> if(strtotime($row['event_date'])) {
> $event_date = date("F m, Y", strtotime($row['event_date']));
> } else {
> $event_date = $row['formatted_event_date'];
> }
>
> Sometimes, it doesn't work.
>
> Every 3rd or 4th registration notification email comes through with an
> empty value for event_date.
>
> There are no other references to the variable $event_date.
>
> It works most of the time.
>
> There's no pattern I can see. I even tried to force it to show a date by
> selecting a formatted date and displaying that if the original programmer's
> strtotime failed.
>
> Where do you look for help with intermittent failures of a date field in
> the DB?
>
>
> --
> John Corry
> PHP developer - 3by400, Inc
> http://www.3by400.com
>
>
--
John Corry
PHP developer - 3by400, Inc
http://www.3by400.com
--- End Message ---
--- Begin Message ---
On Mon, 2010-01-18 at 10:32 -0500, John Corry wrote:
> The field in the DB is defined as type date.
>
> I've had several event registrations for an upcoming event come through. THe
> event date is '2010-01-27'.
>
> 2 of the 5 event registrations contained empty values for the date.
>
> wtf?
>
> On Mon, Jan 18, 2010 at 10:23 AM, John Corry <[email protected]> wrote:
>
> > I maintain a site that is generating some strange behavior...
> >
> > It's a custom built event registration app.
> >
> > Events have event_dates that are stored in the MySQL db.
> >
> > This code retrieves the event title and event date for display on the
> > registration acknowledgment page:
> >
> > $q2 = "SELECT title, event_date, DATE_FORMAT(event_date, '%M %d, %Y') AS
> > formatted_event_date FROM events WHERE id =" . $eid . ";";
> > $result = mysql_query($q2);
> > if ($result) {
> > $row = mysql_fetch_array($result);
> > $title = $row['title'];
> >
> > if(strtotime($row['event_date'])) {
> > $event_date = date("F m, Y", strtotime($row['event_date']));
> > } else {
> > $event_date = $row['formatted_event_date'];
> > }
> >
> > Sometimes, it doesn't work.
> >
> > Every 3rd or 4th registration notification email comes through with an
> > empty value for event_date.
> >
> > There are no other references to the variable $event_date.
> >
> > It works most of the time.
> >
> > There's no pattern I can see. I even tried to force it to show a date by
> > selecting a formatted date and displaying that if the original programmer's
> > strtotime failed.
> >
> > Where do you look for help with intermittent failures of a date field in
> > the DB?
> >
> >
> > --
> > John Corry
> > PHP developer - 3by400, Inc
> > http://www.3by400.com
> >
> >
>
>
This sounds more like a problem with the code that is inserting the data
than the code that is retrieving it. A database should just lose data
randomly from fields unless you've got a really serious problem with
your computer system.
Are you sanitising the data that is being entered by people on the site?
If you don't force them to enter a date, then they might not enter one
at all, leading a null value or empty string to be entered into the date
field instead of a valid date.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---