Re: [PHP] RSYNC - who knows more?

2010-01-18 Thread Richard
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

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



[PHP] Zend debugger doesn't work

2010-01-18 Thread Ali Asghar Toraby Parizy
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?

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



[PHP] integrating shipping with shopping cart site - OT

2010-01-18 Thread Angelo Zanetti
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 



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



Re: [PHP] RSYNC - who knows more?

2010-01-18 Thread Michael Kubler

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


Re: [PHP] RSYNC - who knows more?

2010-01-18 Thread Jens Geier
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 mdk...@gmail.com schrieb im Newsbeitrag 
news:4b542e73.8040...@gmail.com...
 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
 



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



[PHP] 64 Bit IIS 6 ( 32 Bit mode ) + 32Bit php connect with MS-SQL Server

2010-01-18 Thread Edward S.P. Leong
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



[PHP] Notices flooding logs with fastcgi

2010-01-18 Thread Max Zimmermann
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//httpdocs/
x3/inc/shopstat_functions.inc.php on line 82

Thanks so much in advance,
--
Cheers,

Max


GNU/Linux - User #477672
PGP: 0x6C29B594


Re: [PHP] Notices flooding logs with fastcgi

2010-01-18 Thread Ashley Sheridan
On Mon, 2010-01-18 at 12:20 +, 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//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




Re: [PHP] Notices flooding logs with fastcgi

2010-01-18 Thread Max Zimmermann
2010/1/18 Ashley Sheridan a...@ashleysheridan.co.uk

  On Mon, 2010-01-18 at 12:20 +, 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//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


Re: [PHP] 64 Bit IIS 6 ( 32 Bit mode ) + 32Bit php connect with MS-SQL Server

2010-01-18 Thread Richard Quadling
2010/1/18 Edward S.P. Leong edward...@ita.org.mo:
 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=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Notices flooding logs with fastcgi

2010-01-18 Thread Richard Quadling
2010/1/18 Max Zimmermann maxzimmerm...@googlemail.com:
 2010/1/18 Ashley Sheridan a...@ashleysheridan.co.uk

  On Mon, 2010-01-18 at 12:20 +, 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//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=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Notices flooding logs with fastcgi

2010-01-18 Thread Robert Cummings



Ashley Sheridan wrote:

On Mon, 2010-01-18 at 12:20 +, 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//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

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



[PHP] Casting objects.

2010-01-18 Thread Richard Quadling
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=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Notices flooding logs with fastcgi

2010-01-18 Thread Max Zimmermann
2010/1/18 Richard Quadling rquadl...@googlemail.com

 2010/1/18 Max Zimmermann maxzimmerm...@googlemail.com:
  2010/1/18 Ashley Sheridan a...@ashleysheridan.co.uk
 
   On Mon, 2010-01-18 at 12:20 +, 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//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=ZEND002498r=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


Re: [PHP] Notices flooding logs with fastcgi

2010-01-18 Thread Max Zimmermann
2010/1/18 Robert Cummings rob...@interjinn.com



 Ashley Sheridan wrote:

 On Mon, 2010-01-18 at 12:20 +, 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//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


[PHP] intermittent failure of php date

2010-01-18 Thread John Corry
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


[PHP] Re: intermittent failure of php date

2010-01-18 Thread John Corry
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 jcorry.li...@gmail.com 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


[PHP] Re: Casting objects.

2010-01-18 Thread Shawn McKenzie
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

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



Re: [PHP] Re: intermittent failure of php date

2010-01-18 Thread Ashley Sheridan
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 jcorry.li...@gmail.com 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




[PHP] Re: Casting objects.

2010-01-18 Thread Shawn McKenzie
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

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



[PHP] Re: Casting objects.

2010-01-18 Thread Shawn McKenzie
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

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



Re: [PHP] 64 Bit IIS 6 ( 32 Bit mode ) + 32Bit php connect with MS-SQL Server

2010-01-18 Thread edwardspl

引述 Richard Quadling rquadl...@googlemail.com:


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:\php5php -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\extdir php_mssql.dll
 Volume in drive T is Data
 Volume Serial Number is DC85-706F

 Directory of T:\php5\ext

2009/12/16  下午 05:0649,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 : i...@ita.org.mo


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



Re: [PHP] integrating shipping with shopping cart site - OT

2010-01-18 Thread Jochem Maas
Op 1/18/10 10:47 AM, Angelo Zanetti schreef:
 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.

I'd start with defining shippingcost 'sets', each defining a number of
costs by weight bands, some 'table defs':

set:
-
id  name

set_bands:
--
set_id  upper_weightcost


then it would be a case of linking (many-to-many relation) 'regions' to sets,
if you approach this with a tree of regions you can effectively set values at
a continent, country, state/province level ... as such you would only need to
relate a 'shippingcostset' to a state if the shippingcosts are different to
the given country's shippingcosts.

world
 - north america
   - california
 - south america
 - europe
   - france
   - UK

then your left with the problem of determining the smallest defined region a 
given
address physically falls into .. using geo-spatial magic in the DB would be one
way to do it.

this is a hard problem (unless, maybe, the client is willing to sacrifice 
precision
and instead using highly averaged shipping cost definitions to cover the real 
differences
in costs - i.e. a fixed fee for all of europe, whereby such fee is just above 
the
average real cost the client pays for shipping).

my guess would be that building such a thing is hard, and would take lots of
time ... best bet is to hook into the webservice of whatever shipping company 
the
client intends to use ... even if you have to build your end of the webservice 
from
scratch it will be many factors less hard that building a user-manageable, 
shipping cost
algorythm.

- sorry it's all a bit vague, I'm very tired :) my eyes are starting to bleed.


 
 Thanks in advance.
 Angelo
 
 
 http://www.wapit.co.za
 http://www.elemental.co.za 
 
 
 


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



[PHP] 64 bit date in 32 bit php ??

2010-01-18 Thread Michael A. Peters

php 5.2.12 running in CentOS 5.x

Unfortunately, both my server (xen linode) and my test server (crappy 
old dell I found in a field) are 32-bit. I need to work with some dates 
earlier than 1901 and I would really prefer to store them in *nix time 
in the database and use the date() function to format them for display 
when I need to.


My understanding is that 32 bit php has a lower limit in 1901 and upper 
limit in 2038 for the date function.


Is there a pcre / pecl / other wrapper that behaves identical to the 
date function but uses a 64 bit float in 32 bit php?


Yes, the right thing to do is probably to use 64 bit, and if I could I 
would. A wrapper that just passes it off to date on 64 bit systems and 
to date on 32 bit systems within what data can handle and only does its 
magic on 32 bit systems with values beyond 32-bit date capabilities 
would be sweet.


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