RE: [PHP] Array_diff problems

2012-04-27 Thread admin


-Original Message-
From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
Sent: Friday, April 27, 2012 3:37 PM
To: PHP-General
Subject: [PHP] Array_diff problems

Hello all.

I have two arrays and when compared against each other via array_diff, I do
not get any output:

$myarray1 = Array (
[0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10
[Frequency_Description] = Total [Other_Funding] = ) [1] = Array ( [id] =
2 [Funding_Type] = Trust [Amount] = 20 [Frequency_Description] = Per Year
[Other_Funding] = ) [2] = Array ( [id] = 3 [Funding_Type] = Other
Funding [Amount] = 30 [Frequency_Description] = Other [Other_Funding] =
some )) 

$myarray2 = Array
(
[0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10
[Frequency_Description] = Total [Other_Funding] = ) [1] = Array ( [id] =
2 [Funding_Type] = Trust [Amount] = 20 [Frequency_Description] = Per Year
[Other_Funding] = ) [2] = Array ( [id] = 3 [Funding_Type] = Other
Funding [Amount] = 50 [Frequency_Description] = Other [Other_Funding] =
none )) 

$arraydifferences = (array_diff($myarray1,$myarray2));

I need $arraydifferences to record the differences between the two.

Any help is appreciated.

Thanks,
 
 --Rick



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



I suggest you read Multidimensional array_diff for Nested Arrays and your
format is not correct on the array that you gave an example of.

http://www.php.net/manual/en/function.array-diff.php#98680





 


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



Re: [PHP] Array_diff problems

2012-04-27 Thread Rick Dwyer
Thanks to both for the direction.


 
 --Rick
On Apr 27, 2012, at 4:13 PM, Jim Giner wrote:

 
 
 Are these arrays nested in an array?  In that case the manual says you have 
 to do the compare differently.


On Apr 27, 2012, at 4:19 PM, admin wrote:

 
 
 -Original Message-
 From: Rick Dwyer [mailto:rpdw...@earthlink.net] 
 Sent: Friday, April 27, 2012 3:37 PM
 To: PHP-General
 Subject: [PHP] Array_diff problems
 
 Hello all.
 
 I have two arrays and when compared against each other via array_diff, I do
 not get any output:
 
 $myarray1 = Array (
 [0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10
 [Frequency_Description] = Total [Other_Funding] = ) [1] = Array ( [id] =
 2 [Funding_Type] = Trust [Amount] = 20 [Frequency_Description] = Per Year
 [Other_Funding] = ) [2] = Array ( [id] = 3 [Funding_Type] = Other
 Funding [Amount] = 30 [Frequency_Description] = Other [Other_Funding] =
 some )) 
 
 $myarray2 = Array
 (
 [0] = Array ( [id] = 1 [Funding_Type] = Federal [Amount] = 10
 [Frequency_Description] = Total [Other_Funding] = ) [1] = Array ( [id] =
 2 [Funding_Type] = Trust [Amount] = 20 [Frequency_Description] = Per Year
 [Other_Funding] = ) [2] = Array ( [id] = 3 [Funding_Type] = Other
 Funding [Amount] = 50 [Frequency_Description] = Other [Other_Funding] =
 none )) 
 
 $arraydifferences = (array_diff($myarray1,$myarray2));
 
 I need $arraydifferences to record the differences between the two.
 
 Any help is appreciated.
 
 Thanks,
 
 --Rick
 
 
 
 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php
 
 
 
 I suggest you read Multidimensional array_diff for Nested Arrays and your
 format is not correct on the array that you gave an example of.
 
 http://www.php.net/manual/en/function.array-diff.php#98680
 
 
 
 
 
 
 


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



Re: [PHP] php.net problems?

2012-01-23 Thread Xavier Del Castillo

On 01/23/2012 10:28 AM, Donovan Brooke wrote:

Hi, is anyone else having problems with PHP.net today?

Donovan


Working fine from here. Do a traceroute to the site, it might an ISP 
related problem.


Xavier

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



Re: [PHP] php.net problems?

2012-01-23 Thread Curtis Maurand


Xavier Del Castillo wrote:
 On 01/23/2012 10:28 AM, Donovan
Brooke wrote:
 Hi, is anyone else having problems with
PHP.net today?

 Donovan


 Working fine from here. Do a traceroute to the site,
it might an ISP
 related problem.
 
 
It
came right up for me.

--Curtis


Re: [PHP] php.net problems?

2012-01-23 Thread Alex Nikitin
Can't get to doc at all here...

--
The trouble with programmers is that you can never tell what a
programmer is doing until it’s too late.  ~Seymour Cray

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



Re: [PHP] php.net problems?

2012-01-23 Thread Dpto Ingeniería y Desarrollo
I can access to php.net, but in the 'Documentation', it doesn't show the 
View online formats


Also, I can't search a function in Search for '' in the function list 
form.


And if i try access to a url from google result, as
php.net/manual/es/function.in-array.php

i get the following answer:
not found

edit: right now, in the Documentation - View Oline Formats, it shows 
only the English option

I can access to
php.net/manual/en/function.in-array.php

but not
php.net/manual/es/function.in-array.php


El 23/01/12 19:27, Curtis Maurand escribió:


Xavier Del Castillo wrote:

On 01/23/2012 10:28 AM, Donovan

Brooke wrote:

Hi, is anyone else having problems with

PHP.net today?

Donovan



Working fine from here. Do a traceroute to the site,

it might an ISP

related problem.



It
came right up for me.

--Curtis



--
Dpto. Ingeniería y Desarrollo
ingenie...@ort-telecomunicaciones.es
ORT Telecomunicaciones
Tlfno: (+34) 951 221 005




Re: [PHP] php.net problems?

2012-01-23 Thread TR Shaw
From here is US everthing is hosed. Also hosed in CA mirrors.  Additionally 
site says last updated today at 15:20:19 MST bit it is 11:40 MST!  

On Jan 23, 2012, at 1:36 PM, Dpto Ingeniería y Desarrollo wrote:

 I can access to php.net, but in the 'Documentation', it doesn't show the View 
 online formats
 
 Also, I can't search a function in Search for '' in the function list form.
 
 And if i try access to a url from google result, as
 php.net/manual/es/function.in-array.php
 
 i get the following answer:
 not found
 
 edit: right now, in the Documentation - View Oline Formats, it shows only the 
 English option
 I can access to
 php.net/manual/en/function.in-array.php
 
 but not
 php.net/manual/es/function.in-array.php
 
 
 El 23/01/12 19:27, Curtis Maurand escribió:
 
 Xavier Del Castillo wrote:
 On 01/23/2012 10:28 AM, Donovan
 Brooke wrote:
 Hi, is anyone else having problems with
 PHP.net today?
 Donovan
 
 
 Working fine from here. Do a traceroute to the site,
 it might an ISP
 related problem.
 
 
 It
 came right up for me.
 
 --Curtis
 
 
 -- 
 Dpto. Ingeniería y Desarrollo
 ingenie...@ort-telecomunicaciones.es
 ORT Telecomunicaciones
 Tlfno: (+34) 951 221 005
 
 


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



Re: [PHP] php.net problems?

2012-01-23 Thread Alex Nikitin
Rasmus confirmed that they are having issues with php.net:

You can use the sk.php.net mirror while they fix their problems, as
well as docs.php.net.

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



Re: [PHP] php.net problems?

2012-01-23 Thread Daniel Brown
2012/1/23 Alex Nikitin niks...@gmail.com:
 Rasmus confirmed that they are having issues with php.net:

 You can use the sk.php.net mirror while they fix their problems, as
 well as docs.php.net.

We had a primary system failure at the same time as a migration
was underway, which led to complications and subsequent failures of
the mirroring network.  The issues are being resolved and mirrors are
coming back online.  In the meantime, you may use one of the following
mirrors:

http://ca2.php.net/
http://sk.php.net/
http://docs.php.net/

And, until the matter is completely resolved, you can temporarily
change your mirror preference at the bottom of this page:

http://php.net/my.php

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] php.net problems?

2012-01-23 Thread Donovan Brooke

Daniel Brown wrote:

2012/1/23 Alex Nikitinniks...@gmail.com:

Rasmus confirmed that they are having issues with php.net:

You can use the sk.php.net mirror while they fix their problems, as
well as docs.php.net.


 We had a primary system failure at the same time as a migration
was underway, which led to complications and subsequent failures of
the mirroring network.  The issues are being resolved and mirrors are
coming back online.  In the meantime, you may use one of the following
mirrors:

 http://ca2.php.net/
 http://sk.php.net/
 http://docs.php.net/

 And, until the matter is completely resolved, you can temporarily
change your mirror preference at the bottom of this page:

 http://php.net/my.php




Good!, thought I went insane there for a moment and couldn't remember 
any of the PHP functions... (as nothing was coming up in the search) ;-)


Donovan



--
D Brooke

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



Re: [PHP] php.net problems?

2012-01-23 Thread Daniel Brown
On Mon, Jan 23, 2012 at 15:59, Donovan Brooke li...@euca.us wrote:

 Good!, thought I went insane there for a moment and couldn't remember any of
 the PHP functions... (as nothing was coming up in the search) ;-)

Can't it be both?  ;-P

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] php.net problems?

2012-01-23 Thread Donovan Brooke

Daniel Brown wrote:

On Mon, Jan 23, 2012 at 15:59, Donovan Brookeli...@euca.us  wrote:


Good!, thought I went insane there for a moment and couldn't remember any of
the PHP functions... (as nothing was coming up in the search) ;-)


 Can't it be both?  ;-P



Purple cucumbers are automobile..

Donovan


--
D Brooke

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



Re: [PHP] php.net problems?

2012-01-23 Thread Daniel Brown
On Mon, Jan 23, 2012 at 16:30, Donovan Brooke li...@euca.us wrote:

 Purple cucumbers are automobile..

Mmm.  *nods*   Giggity.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Continued Problems Accessing *.php.net?

2012-01-23 Thread Ghodmode
I don't know what all the fuss was about.  What's wrong with you
people.  That document has been there for so many years... you should
have memorized it by now!

--
Ghodmode
http://www.ghodmode.com


On Tue, Jan 24, 2012 at 7:22 AM, Daniel Brown danbr...@php.net wrote:
    ALL:

    As you may have noticed, early this morning we got bored and
 decided to delete php.net from the Internet.  After getting an
 estimated sixteen-point-four trillion complaints, we became
 overwhelmed and aggravated by your incessant need to RTFM that we
 pressed CTRL+Z and brought it back.  You're welcome.

    In earnest, a catastrophic failure on one of our systems coincided
 with a migration effort being headed by some very talented folks.
 This led to a domino effect of issues that resulted in a temporary -
 but widespread - impact on the online version of the documentation and
 downloads.  Things are nearly back to normal now across the network
 --- or so it seems.  If you come across any issues on your favorite
 *.php.net mirror, please let us know at https://bugs.php.net/ or via a
 reply to this thread and we'll check it out.

    As a result, a list of the top ten reasons PHP had an outage today:

        10.) We installed an experimental PECL module named Invisible Ink.
         9.) We learned our indoor solar panels don't work when the
 lights get turned off.
         8.) We had our mobile bandwidth slowed to a crawl because we
 exceeded 2GB for the month.
         7.) A Groupon swarm for two free downloads for the price of
 one killed our network.
         6.) We whited out this time to protest another
 Patriots/Giants Superbowl, while the BC Lions never even got a phone
 call.
         5.) Our build of mod_expires runs on the Mayan calendar, and
 attempting to do a 60-day expire segfaulted.
         4.) The $25.90 check we wrote to cover the server's AOL
 dial-up bounced.
         3.) It's Chinese New Year, but it was too cold to set off the
 fireworks outside today, so sorry.
         2.) As it turned out, all our base truly were belong to them.
         1.) We needed 7,500,001 signatures on the petition against SOPA/PIPA.

    Thanks to all for your patience and such.  And, of course, apologies to 
 all.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

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


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



Re: [PHP] Curl problems

2012-01-11 Thread Matijn Woudt
On Thu, Jan 12, 2012 at 12:20 AM, Rick Dwyer rpdw...@earthlink.net wrote:
 Hello all.

 I use curl to make a call to another page on my site... but it operates
 erroneously sometimes working... sometimes not.  The page it calls
 creates an email and I can see on the server the email in the queue when
 it's working.  If I echo out the URL the curl command is supposed to load
 and load it manually, it works without fail.

 Any help on what I am doing wrong below is greatly appreciated.

 Thanks.


 $curl_handle=curl_init();
 curl_setopt($curl_handle,CURLOPT_URL,'https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
 curl_exec($curl_handle);
 curl_close($curl_handle);

  --Rick

It's maybe not a real answer to your question, but if all you want to
do is call that page, why don't you just use
file_get_contents(https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
(See [1])
It works out of the box, and I have found curl unstable too sometimes.

Matijn

[1] www.php.net/file_get_contents

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



Re: [PHP] Curl problems

2012-01-11 Thread Rick Dwyer

On Jan 11, 2012, at 6:29 PM, Matijn Woudt wrote:

On Thu, Jan 12, 2012 at 12:20 AM, Rick Dwyer rpdw...@earthlink.net  
wrote:

Hello all.

I use curl to make a call to another page on my site... but it  
operates
erroneously sometimes working... sometimes not.  The page it  
calls
creates an email and I can see on the server the email in the queue  
when
it's working.  If I echo out the URL the curl command is supposed  
to load

and load it manually, it works without fail.

Any help on what I am doing wrong below is greatly appreciated.

Thanks.


$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id) 
;

curl_exec($curl_handle);
curl_close($curl_handle);

 --Rick


It's maybe not a real answer to your question, but if all you want to
do is call that page, why don't you just use
file_get_contents(https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id 
);

(See [1])
It works out of the box, and I have found curl unstable too sometimes.

Matijn


Thanks Matijn,
But I get Notice: file_get_contents() [function.file-get-contents]:  
Unable to find the wrapper https - did you forget to enable it when  
you configured PHP?... I'm using a hosting provider and I don't  
believe they will enable this for security reasons.


--Rick



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



Re: [PHP] Curl problems

2012-01-11 Thread Matijn Woudt
On Thu, Jan 12, 2012 at 12:44 AM, Rick Dwyer rpdw...@earthlink.net wrote:
 On Jan 11, 2012, at 6:29 PM, Matijn Woudt wrote:

 On Thu, Jan 12, 2012 at 12:20 AM, Rick Dwyer rpdw...@earthlink.net
 wrote:

 Hello all.

 I use curl to make a call to another page on my site... but it operates
 erroneously sometimes working... sometimes not.  The page it calls
 creates an email and I can see on the server the email in the queue when
 it's working.  If I echo out the URL the curl command is supposed to load
 and load it manually, it works without fail.

 Any help on what I am doing wrong below is greatly appreciated.

 Thanks.


 $curl_handle=curl_init();

 curl_setopt($curl_handle,CURLOPT_URL,'https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
 curl_exec($curl_handle);
 curl_close($curl_handle);

  --Rick


 It's maybe not a real answer to your question, but if all you want to
 do is call that page, why don't you just use

 file_get_contents(https://mydomain.com/email_confirmation.htm?id_order='.$id_order.'sess_id='.$sess_id);
 (See [1])
 It works out of the box, and I have found curl unstable too sometimes.

 Matijn


 Thanks Matijn,
 But I get Notice: file_get_contents() [function.file-get-contents]: Unable
 to find the wrapper https - did you forget to enable it when you
 configured PHP?... I'm using a hosting provider and I don't believe they
 will enable this for security reasons.

 --Rick

It seems like they have not compiled PHP with SSL support, or they're
using a pretty old version. Anyway, you're probably stuck with cURL
then, check the return of curl_exec, and if false, call curl_error to
get an error message.

Matijn

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



Re: [PHP] OOP problems

2011-12-15 Thread Alex Pojarsky
I'm not sure I've understood you correctly, but you may try something
like the following primitive autoloader (I didn't debug it, it's just
an example):

class Base
{
protected $_path = '';

public function construct($base_path)
{
$this-_path = $base_path;
}
public function __get($name)
{
$requested_path = $this-_path . DIRECTORY_SEPARATOR . $name;
if (is_dir($requested_path))
{
return new Base($requested_path);
}
else if (is_file($requested_path . '.php'))
{
include ($requested_path . '.php');
$classname = ucfirst($name);
return new $clasname();
}
}
}

// Assuming you have Mysql class in /home/user/project/classes/db/mysql.php
// you may try

$base = new Base(/home/user/project/classes/);
$base-db-mysql-someFunctionOfMysqlClass();

2011/12/15 Dominik Halvoník dominik.halvo...@gmail.com:
 Hello,

 I would like to ask you for help. This days I am trying to build one of my
 applications. But I have problem which stopped me. I have folder whit php
 files like connect.php, delete.php etc. These files contains classes named
 the same as files. So in file connect.php is class Connect. These files are
 placed in folder named mysql and this folder is inside folder named db. In
 folder db is a php file named mysql.php, in this file I include classes
 from folder mysql, after include I declare class MySQL and in it I have
 method __construct(). In this method I create dynamic objects from included
 classes. And this is the problem that I can not solve, I have more then one
 of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle]
 etc.) and I need to include them to file called db.php that is in the main
 folder of my app. In db.php is an class called db, how can I add classes
 MySQL, Oracle etc. to class db? I try to use abstract class whit __set and
 __get methods but I also need to include class db to main class
 application. I am really sorry for my English, so please be indulgent. So I
 need to connect classes like this:

 application-db-mysql-connect, but I can not use extends because in php
 you can have only one parent class. The reason why I am trying to do
 something like this is because I want to call methods like this:
 $test = new application();
 $test-db-connect();

 If it is mysql or othet database I set in config.php file.

 I need to achieve this schema( - is something like ../ it means that it is
 one level up folder):

 connec.php(class Connect MySql)-
 select.php(class Select MySql) -
  - mysql.php(class MySQL include all classes, Connect...)-
  -
 ... -
 - db.php(class db include all classes, MySQL, Oracle..)
 connec.php(class Connect Oracle)-
 select.php(class Select Oracle ) -
  - oracle .php(class Oracle include all classes, Connect...)-
  -
 ... -

 download.php(class Download)-
 unzip.php(class Unzip) -
  - files.php(class Files include all classes, Download...) -
 file.php(class file include class Files)
  -
 ... -

 hash.php(class Hash)-
 capcha.php(class Capcha) -
  - secure.php(class Secure include all classes, Hash...) -
 security.php(class security include class Secure)
  -
 ... -
 ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect.

 And in the end, in the same folder as db.php and security.php I will have
 file application.php which will contain class application and in its
 __construct() method I will make link classes db, security, file ect. ect.
 So I will just include file application.php make object from class
 application and then just do $object-db-connect()(of course if it will by
 MySql or other database will be stored in some config.php file).

 Thanks,

 Dominik

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



Re: [PHP] OOP problems

2011-12-15 Thread Fatih P.


On 12/15/2011 01:05 PM, Alex Pojarsky wrote:

I'm not sure I've understood you correctly, but you may try something
like the following primitive autoloader (I didn't debug it, it's just
an example):

class Base
{
 protected $_path = '';

 public function construct($base_path)
 {
 $this-_path = $base_path;
 }
 public function __get($name)
 {
 $requested_path = $this-_path . DIRECTORY_SEPARATOR . $name;
 if (is_dir($requested_path))
 {
 return new Base($requested_path);
 }
 else if (is_file($requested_path . '.php'))
 {
 include ($requested_path . '.php');
 $classname = ucfirst($name);
 return new $clasname();
 }
 }
}

// Assuming you have Mysql class in /home/user/project/classes/db/mysql.php
// you may try

$base = new Base(/home/user/project/classes/);
$base-db-mysql-someFunctionOfMysqlClass();

2011/12/15 Dominik Halvoníkdominik.halvo...@gmail.com:

Hello,

I would like to ask you for help. This days I am trying to build one of my
applications. But I have problem which stopped me. I have folder whit php
files like connect.php, delete.php etc. These files contains classes named
the same as files. So in file connect.php is class Connect. These files are
placed in folder named mysql and this folder is inside folder named db. In
folder db is a php file named mysql.php, in this file I include classes
from folder mysql, after include I declare class MySQL and in it I have
method __construct(). In this method I create dynamic objects from included
classes. And this is the problem that I can not solve, I have more then one
of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle]
etc.) and I need to include them to file called db.php that is in the main
folder of my app. In db.php is an class called db, how can I add classes
MySQL, Oracle etc. to class db? I try to use abstract class whit __set and
__get methods but I also need to include class db to main class
application. I am really sorry for my English, so please be indulgent. So I
need to connect classes like this:

application-db-mysql-connect, but I can not use extends because in php
you can have only one parent class. The reason why I am trying to do
something like this is because I want to call methods like this:
$test = new application();
$test-db-connect();

If it is mysql or othet database I set in config.php file.

I need to achieve this schema( -  is something like ../ it means that it is
one level up folder):

connec.php(class Connect MySql)-
select.php(class Select MySql) -
 -  mysql.php(class MySQL include all classes, Connect...)-
 -
... -
-  db.php(class db include all classes, MySQL, Oracle..)
connec.php(class Connect Oracle)-
select.php(class Select Oracle ) -
 -  oracle .php(class Oracle include all classes, Connect...)-
 -
... -

download.php(class Download)-
unzip.php(class Unzip) -
 -  files.php(class Files include all classes, Download...) -
file.php(class file include class Files)
 -
... -

hash.php(class Hash)-
capcha.php(class Capcha) -
 -  secure.php(class Secure include all classes, Hash...) -
security.php(class security include class Secure)
 -
... -
ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect.

And in the end, in the same folder as db.php and security.php I will have
file application.php which will contain class application and in its
__construct() method I will make link classes db, security, file ect. ect.
So I will just include file application.php make object from class
application and then just do $object-db-connect()(of course if it will by
MySql or other database will be stored in some config.php file).

Thanks,

Dominik

Why don't you modify include_path on initialization of 'Base' class?

would make things much simpler.

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



Re: [PHP] OOP problems

2011-12-11 Thread Dominik Halvoník
Hi guys,

I try to applied your solutions but I have problems whit it. I need to
achieve this schema( -  is something like ../ it means that it is one
level up folder):

connec.php(class Connect MySql)-
select.php(class Select MySql) -
 - mysql.php(class MySQL
include all classes, Connect...)-
 -
...  -

  -
db.php(class db include all classes, MySQL, Oracle..)
 connec.php(class Connect Oracle)-
select.php(class Select Oracle ) -
 -  oracle .php(class
Oracle include all classes, Connect...)-
 -
...  -

download.php(class Download)-
unzip.php(class Unzip) -
 - files.php(class Files
include all classes, Download...) - file.php(class file include class
Files)
 -
...  -

hash.php(class Hash)-
capcha.php(class Capcha) -
 - secure.php(class Secure
include all classes, Hash...) - security.php(class security include class
Secure)
 -
...  -
*ect. ect. ect.  ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect. ect.
*

And in the end, in the same folder as db.php and security.php I will have
file application.php which will contain class application and in its
__construct() method I will make link classes db, security, file ect. ect.
So I will just include file application.php make object from class
application and then just do $object-db-connect()(of course if it will by
MySql or other database will be stored in some config.php file).

Thanks,

Dominik


Re: [PHP] OOP problems

2011-12-08 Thread Stuart Dallas
On 8 Dec 2011, at 17:14, Dominik Halvoník wrote:

 I would like to ask you for help. This days I am trying to build one of my
 applications. But I have problem which stopped me. I have folder whit php
 files like connect.php, delete.php etc. These files contains classes named
 the same as files. So in file connect.php is class Connect. These files are
 placed in folder named mysql and this folder is inside folder named db. In
 folder db is a php file named mysql.php, in this file I include classes
 from folder mysql, after include I declare class MySQL and in it I have
 method __construct(). In this method I create dynamic objects from included
 classes. And this is the problem that I can not solve, I have more then one
 of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle]
 etc.) and I need to include them to file called db.php that is in the main
 folder of my app. In db.php is an class called db, how can I add classes
 MySQL, Oracle etc. to class db? I try to use abstract class whit __set and
 __get methods but I also need to include class db to main class
 application. I am really sorry for my English, so please be indulgent. So I
 need to connect classes like this:
 
 application-db-mysql-connect, but I can not use extends because in php
 you can have only one parent class. The reason why I am trying to do
 something like this is because I want to call methods like this:
 $test = new application();
 $test-db-connect();
 
 If it is mysql or othet database I set in config.php file. Can you help my
 please?


You don't say what the db class (in db.php) itself does other than wrapping the 
database-specific classes, so I've assumed it doesn't do anything. If it does 
do more then simply have the mysql, oracle, etc classes extend db.

I've also assumed that the application doesn't need to support multiple 
database types simultaneously.

class application
{
  public $db = null;

  function __construct($db = 'mysql')
  {
require __DIR__.'/db/'.$db.'.php';
$this-db = new MySQL();
  }
}

$test = new application('mysql');
$test-db-connect();

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

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



Re: [PHP] OOP problems

2011-12-08 Thread Mokaddim Akm
Sent from a handheld device

On 08-Dec-2011, at 11:14 PM, Dominik Halvoník
dominik.halvo...@gmail.com wrote:

 Hello,

 I would like to ask you for help. This days I am trying to build one of my
 applications. But I have problem which stopped me. I have folder whit php
 files like connect.php, delete.php etc. These files contains classes named
 the same as files. So in file connect.php is class Connect. These files are
 placed in folder named mysql and this folder is inside folder named db. In
 folder db is a php file named mysql.php, in this file I include classes
 from folder mysql, after include I declare class MySQL and in it I have
 method __construct(). In this method I create dynamic objects from included
 classes. And this is the problem that I can not solve, I have more then one
 of this files(mysql.php[whit class MySQL], oracle.php[whit class Oracle]
 etc.) and I need to include them to file called db.php that is in the main
 folder of my app. In db.php is an class called db, how can I add classes
 MySQL, Oracle etc. to class db? I try to use abstract class whit __set and
 __get methods but I also need to include class db to main class
 application. I am really sorry for my English, so please be indulgent. So I
 need to connect classes like this:


This is where common design patters comes handy.
Your problem can be solved by factory pattern.
Create a static method connect on db class. Then call it like
$db = DB::connect($db_type)

Here the db type variable contains MySQL or oracle. In connect static
method you implement the logic on how to connect that specific
database. In the connect method you can also take db credentials like
username and password.

Google php design pattern to know more.


 application-db-mysql-connect, but I can not use extends because in php
 you can have only one parent class. The reason why I am trying to do
 something like this is because I want to call methods like this:
 $test = new application();
 $test-db-connect();

 If it is mysql or othet database I set in config.php file. Can you help my
 please?

 Sincerely,

 Dominik Halvonik

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



Re: [PHP] mysql problems [SOLVED]

2011-05-14 Thread Curtis Maurand


Sean Greenslade wrote:


 
 [MASSIVE
SNIP]
 
 Well, from what I saw while wading through your
code, you allow
 unsanitized
 variables to be
concatenated to your queries. Big no-no! For ANY

client-generated variable, always sanitize with
mysql_real_escape_string.
 In
 fact, sanitize all your
variables. It can't hurt.
 
 Also, please don't take a
request for your entire code too literally. We
 don't like to see
pages and pages and pages of code, just the pertinent
 bits.
 --
 --Zootboy
 
 Sent from my PC.
 
Thanks to all, but it was an infinite loop.  there was a
while ($_parent != 0) { } loop.  In the loop the database
is queried.  If the returned number of rows is greater than 0 then
perform then grab a $_parent from the database.  At some point, there
must be a parent that is = 0 and the loop breaks.  However, if the
page is called with category number that doesn't exist, then the if/then
clause is never true and $_parent never gets set to 0.  I simply
added and else clause.
while ($_parent != 0)
{
  if
($num_rows  0)
   {

perform some action
   }
   else
   {
 $_parent =
0;
   }
}

and that solved the
problem.

Thank you, everyone for your help.  

Curtis


RE: [PHP] mysql problems [SOLVED]

2011-05-14 Thread Jasper Mulder

[SNIP]
 added and else clause.
 while ($_parent != 0)
 {
   if
 ($num_rows  0)
{

 perform some action
}
else
{
  $_parent =
 0;
}
 }

 and that solved the
 problem.

 Thank you, everyone for your help.

 Curtis

A small remark:
I think it is good programming practice to place such static if-clauses before 
the while statement.
This prevents a lot of redundant checks and thus saves time.

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



Re: Re: [PHP] mysql problems

2011-05-12 Thread Tim Streater
On 11 May 2011 at 19:25, Curtis Maurand cur...@maurand.com wrote: 

 $_cartTotal=$0.00;

Surely that should be:

$_cartTotal = 0.00;


tim


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

Re: Re: [PHP] mysql problems

2011-05-12 Thread Curtis Maurand



Tim Streater wrote:
 On 11 May 2011 at 19:25, Curtis
Maurand cur...@maurand.com wrote:
 

$_cartTotal=$0.00;
 
 Surely that should
be:
 
 $_cartTotal = 0.00;

Good
pickup.  I missed that.  I didn't write the code, I'm just
trying to figure out what's going on.
 Thanks,  I'll look at
that.  --C


Re: [PHP] mysql problems

2011-05-11 Thread Marc Guay
 Does anyone have any ideas?

Sounds like it's getting caught in a loop.  Post the whole script for
best results.

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



Re: [PHP] mysql problems

2011-05-11 Thread Curtis Maurand


Marc Guay wrote:
 Does anyone have any ideas?
 
 Sounds like it's getting caught in a loop.  Post the whole script
for
 best results.
 
It looks like the site is
under attack, because I keep seeing the query, SELECT catagory_parent FROM 
t_catagories where catagory_ID= .
$_currentCat

where $_currentCat is equal to a
value not in the database.  The only way that this can happen is if
the page is called directly without going through the default page.


the script follows.  its called leftNav.php



?php
include
'media/includes/productDetail.php';

//$username =
alaric;
$username = pinetree;
//$password = password_removed;
$password =
password_removed;
$hostname = 127.0.0.1;
//$hostname = www.superseeds.com;

if($_SESSION[u_id]==){
$_SESSION[u_id] = uniqid();
}

//
$_cartTotal=$0.00;
$_cartCount=0;





function tallyCart($_u_id){
    global $username;
    global
$password;
    global $hostname; 
    global $_cartTotal; 
    global
$_cartCount; 
    
    $dbhandle =
mysql_connect($hostname, $username, $password) 
   
     or die(Unable to connect to
MySQL);
         
    $selected =
mysql_select_db(pinetree,$dbhandle) 
   
  or die(Could not select examples);
    
    //execute the SQL query and
return records
    $result = mysql_query(SELECT
* from tbl_Cart where u_ID='.$_u_id.');
    $_holder=;
    
    $_counter=0;
   
$_getSubTotal=0;
    $_showCheckOut=0;
    while ($row = mysql_fetch_array($result)) {
        $_showCheckOut=1;
        $_pdetail=new
ProductDetail($row{'product_ID'}, $row{'product_Quantity'}, $_u_id);
         $_getSubTotal +=
$_pdetail-_subTotal;
       
 $_counter++;
 }
   
$_cartTotal = $.number_format($_getSubTotal,2);
    $_cartCount = $_counter;
   
mysql_close($dbhandle);
}

tallyCart($_SESSION[u_id]);
?





div id=div_cartCall
    div id=div_cartCall_head
    You have ?php echo $_cartCount? items in your
cart.br/br/
    Cart total: ?php
echo $_cartTotal?
    /div
    div id=div_cartCall_foot
    a href=cart.php#65533; Go to
cart/a
    /div
/div
p





  ?php

//$username = alaric;
$username = pinetree;
//$password =
removed;
$password = removed;
//$hostname = 127.0.0.1;
$hostname =
www.superseeds.com;

$_parents = array();  
$counter=0;

if($_GET[cat]!=){
    $_parent =$_GET[cat];
}
else{
    $_parent =0;
}


$dbhandle2 = mysql_connect($hostname, $username, $password) 
 or die(Unable to connect to MySQL);
//echo
Connected to MySQLbr;

//select a database
to work with
$selected =
mysql_select_db(pinetree,$dbhandle2) 
  or
die(Could not select examples);

   
while ($_parent !=0) {
   
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= .$_parent);
        $num_rows_2 =
mysql_num_rows($result_2);
       
if($num_rows_2  0)
   
    {
       
    while ($row = mysql_fetch_array($result_2)) {
           
    $_parent= $row{'catagory_parent'};
           
    $_parents[$counter] = $row{'catagory_parent'};
           
    $counter++;
       
    }
        }
    }
    mysql_close($dbhandle2);
    



function getParent($catID,
$matchingID){

//$username = alaric;
$username
= pinetree;
//$password = removed;
$password = removed;
//$hostname =
127.0.0.1;
$hostname = www.superseeds.com;
    
    
   
$_parent=1;
    $_currentCat=$catID;
    $dbhandle2 = mysql_connect($hostname, $username,
$password) 
     or die(Unable to connect
to MySQL);
    //echo Connected to
MySQLbr;
    
   
//select a database to work with
    $selected =
mysql_select_db(pinetree,$dbhandle2) 
   
  or die(Could not select examples);
    
        while
($_parent !=0) {
       
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= . $_currentCat);
              while
($row = mysql_fetch_array($result_2)) {
   
           
$_parent=$row{'catagory_parent'};
   
           
if($row{'catagory_parent'}==$matchingID){
   
           
    mysql_close($dbhandle2);
   
           
 return true;
   
             }
   
 
}
        }
   
mysql_close($dbhandle2);
    return false;
    
}

?
  
  
  
  ?php






function getRowCount($_catID){

    global
$_parents;
    global $username;
    global $password;
    global
$hostname; 
     
   
$dbhandle = mysql_connect($hostname, $username, $password) 
     or die(Unable to connect to
MySQL);
     
   
$selected = mysql_select_db(pinetree,$dbhandle) 
      or die(Could not select
examples);
     
   
$result = mysql_query(SELECT COUNT(*) as theCount FROM t_catagories
where catagory_parent=.$_catID);
     
    while ($row = mysql_fetch_array($result)) {
       
if($row{'theCount'}==0){
   
        mysql_close($dbhandle);
            return
0;
        }
        else{
   
        mysql_close($dbhandle);
            return
.$row{'theCount'};
       
}
    }
}




function
generateNav($_parent, $_style){

   
if(getRowCount($_parent)0){
    
        global $_parents;
        global $username;
        global $password;
        global $hostname; 
         
   
    $dbhandle3 = 

Re: [PHP] mysql problems

2011-05-11 Thread Curtis Maurand


Marc Guay wrote:
 Does anyone have any ideas?
 
 Sounds like it's getting caught in a loop.  Post the whole script
for
 best results.
 
It looks like the site is
under attack, because I keep seeing the query, SELECT catagory_parent FROM 
t_catagories where catagory_ID= .
$_currentCat

where $_currentCat is equal to a
value not in the database.  The only way that this can happen is if
the page is called directly without going through the default page.


the script follows.  its called leftNav.php



?php
include
'media/includes/productDetail.php';

//$username =
alaric;
$username = pinetree;
//$password = password_removed;
$password =
password_removed;
$hostname = 127.0.0.1;
//$hostname = www.superseeds.com;

if($_SESSION[u_id]==){
$_SESSION[u_id] = uniqid();
}

//
$_cartTotal=$0.00;
$_cartCount=0;





function tallyCart($_u_id){
    global $username;
    global
$password;
    global $hostname; 
    global $_cartTotal; 
    global
$_cartCount; 
    
    $dbhandle =
mysql_connect($hostname, $username, $password) 
   
     or die(Unable to connect to
MySQL);
         
    $selected =
mysql_select_db(pinetree,$dbhandle) 
   
  or die(Could not select examples);
    
    //execute the SQL query and
return records
    $result = mysql_query(SELECT
* from tbl_Cart where u_ID='.$_u_id.');
    $_holder=;
    
    $_counter=0;
   
$_getSubTotal=0;
    $_showCheckOut=0;
    while ($row = mysql_fetch_array($result)) {
        $_showCheckOut=1;
        $_pdetail=new
ProductDetail($row{'product_ID'}, $row{'product_Quantity'}, $_u_id);
         $_getSubTotal +=
$_pdetail-_subTotal;
       
 $_counter++;
 }
   
$_cartTotal = $.number_format($_getSubTotal,2);
    $_cartCount = $_counter;
   
mysql_close($dbhandle);
}

tallyCart($_SESSION[u_id]);
?





div id=div_cartCall
    div id=div_cartCall_head
    You have ?php echo $_cartCount? items in your
cart.br/br/
    Cart total: ?php
echo $_cartTotal?
    /div
    div id=div_cartCall_foot
    a href=cart.php#65533; Go to
cart/a
    /div
/div
p





  ?php

//$username = alaric;
$username = pinetree;
//$password =
removed;
$password = removed;
//$hostname = 127.0.0.1;
$hostname =
www.superseeds.com;

$_parents = array();  
$counter=0;

if($_GET[cat]!=){
    $_parent =$_GET[cat];
}
else{
    $_parent =0;
}


$dbhandle2 = mysql_connect($hostname, $username, $password) 
 or die(Unable to connect to MySQL);
//echo
Connected to MySQLbr;

//select a database
to work with
$selected =
mysql_select_db(pinetree,$dbhandle2) 
  or
die(Could not select examples);

   
while ($_parent !=0) {
   
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= .$_parent);
        $num_rows_2 =
mysql_num_rows($result_2);
       
if($num_rows_2  0)
   
    {
       
    while ($row = mysql_fetch_array($result_2)) {
           
    $_parent= $row{'catagory_parent'};
           
    $_parents[$counter] = $row{'catagory_parent'};
           
    $counter++;
       
    }
        }
    }
    mysql_close($dbhandle2);
    



function getParent($catID,
$matchingID){

//$username = alaric;
$username
= pinetree;
//$password = removed;
$password = removed;
//$hostname =
127.0.0.1;
$hostname = www.superseeds.com;
    
    
   
$_parent=1;
    $_currentCat=$catID;
    $dbhandle2 = mysql_connect($hostname, $username,
$password) 
     or die(Unable to connect
to MySQL);
    //echo Connected to
MySQLbr;
    
   
//select a database to work with
    $selected =
mysql_select_db(pinetree,$dbhandle2) 
   
  or die(Could not select examples);
    
        while
($_parent !=0) {
       
    $result_2 = mysql_query(SELECT catagory_parent
FROM t_catagories where catagory_ID= . $_currentCat);
              while
($row = mysql_fetch_array($result_2)) {
   
           
$_parent=$row{'catagory_parent'};
   
           
if($row{'catagory_parent'}==$matchingID){
   
           
    mysql_close($dbhandle2);
   
           
 return true;
   
             }
   
 
}
        }
   
mysql_close($dbhandle2);
    return false;
    
}

?
  
  
  
  ?php






function getRowCount($_catID){

    global
$_parents;
    global $username;
    global $password;
    global
$hostname; 
     
   
$dbhandle = mysql_connect($hostname, $username, $password) 
     or die(Unable to connect to
MySQL);
     
   
$selected = mysql_select_db(pinetree,$dbhandle) 
      or die(Could not select
examples);
     
   
$result = mysql_query(SELECT COUNT(*) as theCount FROM t_catagories
where catagory_parent=.$_catID);
     
    while ($row = mysql_fetch_array($result)) {
       
if($row{'theCount'}==0){
   
        mysql_close($dbhandle);
            return
0;
        }
        else{
   
        mysql_close($dbhandle);
            return
.$row{'theCount'};
       
}
    }
}




function
generateNav($_parent, $_style){

   
if(getRowCount($_parent)0){
    
        global $_parents;
        global $username;
        global $password;
        global $hostname; 
         
   
    $dbhandle3 = 

Re: [PHP] mysql problems

2011-05-11 Thread Sean Greenslade
On Wed, May 11, 2011 at 2:25 PM, Curtis Maurand cur...@maurand.com wrote:



 Marc Guay wrote:
  Does anyone have any ideas?
 
  Sounds like it's getting caught in a loop.  Post the whole script
 for
  best results.
 
 It looks like the site is
 under attack, because I keep seeing the query, SELECT catagory_parent FROM
 t_catagories where catagory_ID= .
 $_currentCat

 where $_currentCat is equal to a
 value not in the database.  The only way that this can happen is if
 the page is called directly without going through the default page.


 the script follows.  its called leftNav.php


[MASSIVE SNIP]

Well, from what I saw while wading through your code, you allow unsanitized
variables to be concatenated to your queries. Big no-no! For ANY
client-generated variable, always sanitize with mysql_real_escape_string. In
fact, sanitize all your variables. It can't hurt.

Also, please don't take a request for your entire code too literally. We
don't like to see pages and pages and pages of code, just the pertinent
bits.
-- 
--Zootboy

Sent from my PC.


Re: [PHP] Memcache problems

2011-02-04 Thread Jostein Eriksen
Thanks for your help so far. I've just started noticing a bunch of 
zend_mm_heap corrupted in logs, Could this be the reason?


On 02/03/2011 11:12 PM, Alex Nikitin wrote:

Short of some process going crazy, which you should check for, some psing,
top and netstat, i cant think of any reason you should ever get a connection
drop, short of a hardware failure (memory perhaps), or an experimental
kernel settings or modules or something... i cant think of any way that a
connection to 127.0.0.1 would ever possibly get dropped, loopback device
never hits your network hardware...

~Alex

On Thu, Feb 3, 2011 at 5:00 PM, Jostein Eriksenphp-l...@morits.net  wrote:


On 02/03/2011 10:49 PM, Adam Richardson wrote:


On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net
  wrote:

  Both php and memcached is running on the same server.

memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight,
timeout,
retry interval, status, failure callback */
$this-memcache-addServer($value[0],
$value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


  Are you sure you copied this correctly?


In the code above, you set the array key 'serverList' to an array
containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In
the
first iteration of the foreach, $value would equal '127.0.0.1', so
$value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code?
Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam



My bad.

it should be:
'serverList' =  array(
/** host, port, weight, timeout */
'default' =  array('127.0.0.1',
11211, 1, 1),
)),

Didn't copy/paste the $cfg = line, so it got messed up.

/Jostein

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







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



Re: [PHP] Memcache problems

2011-02-03 Thread Alex Nikitin
There could be many a reasons for this, and it really depends on your setup.
For example, is php and memcache on the same server, if they are not what is
the network topology like, it could be a piece of hardware starting to
malfunction, it could be an issue with the networking driver, on the other
hand it could be neither; but to help you figure out where to look, one
should hope to see a little bit more info...

~Alex

On Thu, Feb 3, 2011 at 3:10 PM, Jostein Eriksen php-l...@morits.net wrote:

 Hi,

 I've been having some problems with memcache lately.
 It seems to me that php is dropping connection to the memcache server mid
 way through the scripts.
 I've sat the failure_callback to log failures. And I'm getting a lot of
 them. Several every minute.

 I'm quite stuck now and realy dont know where to go from here.
 I've tried to telnet into the server. And there is no problem with either
 set nor get commands. I've started the memcached daemon with -vvv to see if
 I can dig anything interesting from the logs, but I can find no errors of
 any kind in them. There is also no errors that I can find in the php_error
 log.

 I would appreciate some help, if anyone have any ideas of what is going on.

 thanks.

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




Re: [PHP] Memcache problems

2011-02-03 Thread Jostein Eriksen

Both php and memcached is running on the same server.
memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout, retry interval, status, 
failure callback */
$this-memcache-addServer($value[0], $value[1], false, $value[2], 
$value[3], 2, true, array($this, 'fail'));

}

/Jostein

On 02/03/2011 09:34 PM, Alex Nikitin wrote:

There could be many a reasons for this, and it really depends on your setup.
For example, is php and memcache on the same server, if they are not what is
the network topology like, it could be a piece of hardware starting to
malfunction, it could be an issue with the networking driver, on the other
hand it could be neither; but to help you figure out where to look, one
should hope to see a little bit more info...

~Alex

On Thu, Feb 3, 2011 at 3:10 PM, Jostein Eriksenphp-l...@morits.net  wrote:


Hi,

I've been having some problems with memcache lately.
It seems to me that php is dropping connection to the memcache server mid
way through the scripts.
I've sat the failure_callback to log failures. And I'm getting a lot of
them. Several every minute.

I'm quite stuck now and realy dont know where to go from here.
I've tried to telnet into the server. And there is no problem with either
set nor get commands. I've started the memcached daemon with -vvv to see if
I can dig anything interesting from the logs, but I can find no errors of
any kind in them. There is also no errors that I can find in the php_error
log.

I would appreciate some help, if anyone have any ideas of what is going on.

thanks.

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







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



Re: [PHP] Memcache problems

2011-02-03 Thread Adam Richardson
On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksen php-l...@morits.net wrote:

 Both php and memcached is running on the same server.
 memcached version 1.2.2
 php5-memcache version 2.2.0
 php version 5.2.4

 here is a snippet from my code that may be of interest
 $cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
 ...
 $this-memcache = new Memcache();
 foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout,
 retry interval, status, failure callback */
$this-memcache-addServer($value[0],
 $value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


Are you sure you copied this correctly?

In the code above, you set the array key 'serverList' to an array containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In the
first iteration of the foreach, $value would equal '127.0.0.1', so $value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code? Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] Memcache problems

2011-02-03 Thread Jostein Eriksen

On 02/03/2011 10:49 PM, Adam Richardson wrote:

On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net  wrote:


Both php and memcached is running on the same server.
memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout,
retry interval, status, failure callback */
$this-memcache-addServer($value[0],
$value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}



Are you sure you copied this correctly?

In the code above, you set the array key 'serverList' to an array containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In the
first iteration of the foreach, $value would equal '127.0.0.1', so $value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code? Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam



My bad.

it should be:
'serverList' = array(
/** host, port, weight, timeout */
'default' = array('127.0.0.1', 11211, 
1, 1),
)),

Didn't copy/paste the $cfg = line, so it got messed up.

/Jostein

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



Re: [PHP] Memcache problems

2011-02-03 Thread Alex Nikitin
Short of some process going crazy, which you should check for, some psing,
top and netstat, i cant think of any reason you should ever get a connection
drop, short of a hardware failure (memory perhaps), or an experimental
kernel settings or modules or something... i cant think of any way that a
connection to 127.0.0.1 would ever possibly get dropped, loopback device
never hits your network hardware...

~Alex

On Thu, Feb 3, 2011 at 5:00 PM, Jostein Eriksen php-l...@morits.net wrote:

 On 02/03/2011 10:49 PM, Adam Richardson wrote:

 On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net
  wrote:

  Both php and memcached is running on the same server.
 memcached version 1.2.2
 php5-memcache version 2.2.0
 php version 5.2.4

 here is a snippet from my code that may be of interest
 $cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
 ...
 $this-memcache = new Memcache();
 foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight,
 timeout,
 retry interval, status, failure callback */
$this-memcache-addServer($value[0],
 $value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


  Are you sure you copied this correctly?

 In the code above, you set the array key 'serverList' to an array
 containing
 ('127.0.0.1', 11211, 1, 1);

 Then, you foreach through the values of the 'serverList' array (first
 iteration, value would equal '127.0.0.1', second, value would equal 11211,
 etc.)

 Then, you use array notation to access the first position of $value.  In
 the
 first iteration of the foreach, $value would equal '127.0.0.1', so
 $value[0]
 would give you '1', $value[1] would give you '2', etc.

 Do you see what I'm saying? Did you forget or omit other relevant code?
 Or,
 I'm just having a really bad code day (in this case, I'll likely see my
 error just after sending this email.)

 Adam


 My bad.

 it should be:
 'serverList' = array(
/** host, port, weight, timeout */
'default' = array('127.0.0.1',
 11211, 1, 1),
)),

 Didn't copy/paste the $cfg = line, so it got messed up.

 /Jostein

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




Re: [PHP] Pear Problems

2011-01-28 Thread Daniel Brown
On Fri, Jan 28, 2011 at 00:33, Ethan Rosenberg eth...@earthlink.net wrote:

 Please take a look at php.ini in the vicinity of line 510.  You will see the
 construct to which I refer.  Can you explain what is going on?  I do not
 think it is a problem with commenting out a line.

 Any ideas from the rest of the list?

Keep in mind that php.ini is not universal, and changes
drastically with version, distribution, CLI vs. web, customization,
and more.  The answer that Adam gave you is absolutely correct with
regard to the information you provided.  You need to put a semicolon
before the line you quoted as being line 510 in your php.ini.  The
directive you want is error_reporting, and should look like so:

error_reporting = E_ALL  ~E_NOTICE

-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] Pear Problems

2011-01-27 Thread Ethan Rosenberg

At 01:54 AM 1/27/2011, Adam Richardson wrote:

On Thu, Jan 27, 2011 at 1:01 AM, Ethan Rosenberg eth...@earthlink.netwrote:

 Dear List -

 I am executing the command pear list.

 This is what I get -

 ethan@rosenberg:/usr/bin$ pear list
 PHP:  syntax error, unexpected '' in /etc/php5/cli/php.ini on line 510
 Installed packages, channel pear.php.net:
 =
 Package  Version State
 Archive_Tar  1.3.7   stable
 Console_Getopt   1.2.3   stable
 PEAR 1.9.1   stable
 Structures_Graph 1.0.3   stable
 Validate_US  0.5.4   beta
 XML_Util 1.2.1   stable
 ethan@rosenberg:/usr/bin$

 This is line 510

 Default Value: E_ALL  ~E_NOTICE


That line should likely be commented out (it was probably originally
commented out and then somebody accidentally uncommented.)  Most php.ini
files follow the convention (notice that there's no colon in the example):
some_name = some_value

Happy coding,

Adam

--
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com



Adam -

Thanks.

Please take a look at php.ini in the vicinity of line 510.  You will 
see the construct to which I refer.  Can you explain what is going 
on?  I do not think it is a problem with commenting out a line.


Any ideas from the rest of the list?

Ethan


MySQL 5.1  PHP 5.3.3-6  Linux [Debian (sid)] 




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



Re: [PHP] Pear Problems

2011-01-26 Thread Adam Richardson
On Thu, Jan 27, 2011 at 1:01 AM, Ethan Rosenberg eth...@earthlink.netwrote:

 Dear List -

 I am executing the command pear list.

 This is what I get -

 ethan@rosenberg:/usr/bin$ pear list
 PHP:  syntax error, unexpected '' in /etc/php5/cli/php.ini on line 510
 Installed packages, channel pear.php.net:
 =
 Package  Version State
 Archive_Tar  1.3.7   stable
 Console_Getopt   1.2.3   stable
 PEAR 1.9.1   stable
 Structures_Graph 1.0.3   stable
 Validate_US  0.5.4   beta
 XML_Util 1.2.1   stable
 ethan@rosenberg:/usr/bin$

 This is line 510

 Default Value: E_ALL  ~E_NOTICE


That line should likely be commented out (it was probably originally
commented out and then somebody accidentally uncommented.)  Most php.ini
files follow the convention (notice that there's no colon in the example):
some_name = some_value

Happy coding,

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] Class Problems

2009-08-11 Thread la...@garfieldtech.com
The private keyword was added in PHP 5.  PHP 4 doesn't have visibility 
identifiers.  In PHP 4 you have to use var, which is then always public.


Or you could just use PHP 5 instead of a dead language. :-)

Ashley Sheridan wrote:

Hey all,

Is there any reason why this shouldn't work correctly on a server
running PHP 4.4.7:

?php
class testClass
{
private $foo = 'bar';
}

print 'wtf';
?

I would at the very least expect to see the 'wtf' printed out. I've got
a whole class I've written that works fine in PHP 5, but on PHP 4
server, it does nothing with even this simple example.

Any ideas?

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Class Problems

2009-08-11 Thread Ashley Sheridan
On Tue, 2009-08-11 at 10:40 -0500, la...@garfieldtech.com wrote:
 The private keyword was added in PHP 5.  PHP 4 doesn't have visibility 
 identifiers.  In PHP 4 you have to use var, which is then always public.
 
 Or you could just use PHP 5 instead of a dead language. :-)
 
 Ashley Sheridan wrote:
  Hey all,
  
  Is there any reason why this shouldn't work correctly on a server
  running PHP 4.4.7:
  
  ?php
  class testClass
  {
  private $foo = 'bar';
  }
  
  print 'wtf';
  ?
  
  I would at the very least expect to see the 'wtf' printed out. I've got
  a whole class I've written that works fine in PHP 5, but on PHP 4
  server, it does nothing with even this simple example.
  
  Any ideas?
  
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
  
  
 
Ah, I was looking up in the documentation, but seem to have missed that.
Just changed the code, and it's working again! The public/private thing
will only really be an issue if someone other than me is using this
script, which is unlikely just at the moment, but ah well!

And I really would use a PHP 5 server given the choice. I've tried
speaking to the hosting company a few times, but they brush me off!

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



Re: [PHP] Class Problems

2009-08-11 Thread Aschwin Wesselius

Ashley Sheridan wrote:

And I really would use a PHP 5 server given the choice. I've tried
speaking to the hosting company a few times, but they brush me off!
  

Hi Ashley,

And how is their SLA then? Do you take full responsibility in case of a 
security breach? PHP 4 is way long ago and there are plenty hosting 
companies that do have PHP 5 and have a clear security/update policy.


You, yes YOU, are their client paying their sandwich. If you are not 
serviced properly, they have to eat one less. Now, go on and brush them 
off..


Kind regards,

Aschwin Wesselius

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



Re: [PHP] Class Problems

2009-08-11 Thread Ashley Sheridan
On Tue, 2009-08-11 at 17:57 +0200, Aschwin Wesselius wrote:
 Ashley Sheridan wrote:
  And I really would use a PHP 5 server given the choice. I've tried
  speaking to the hosting company a few times, but they brush me off!

 Hi Ashley,
 
 And how is their SLA then? Do you take full responsibility in case of a 
 security breach? PHP 4 is way long ago and there are plenty hosting 
 companies that do have PHP 5 and have a clear security/update policy.
 
 You, yes YOU, are their client paying their sandwich. If you are not 
 serviced properly, they have to eat one less. Now, go on and brush them 
 off..
 
 Kind regards,
 
 Aschwin Wesselius
 
My last email to them said that if they don't do something soon, then
I'm going elsewhere, so I'll see if that spurs them on. I'm not into
naming and shaming, but if they don't get back to me on this at all,
then I feel a blog rant coming on!

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



Re: [PHP] Class Problems

2009-08-11 Thread la...@garfieldtech.com

Ashley Sheridan wrote:

On Tue, 2009-08-11 at 17:57 +0200, Aschwin Wesselius wrote:

Ashley Sheridan wrote:

And I really would use a PHP 5 server given the choice. I've tried
speaking to the hosting company a few times, but they brush me off!
  

Hi Ashley,

And how is their SLA then? Do you take full responsibility in case of a 
security breach? PHP 4 is way long ago and there are plenty hosting 
companies that do have PHP 5 and have a clear security/update policy.


You, yes YOU, are their client paying their sandwich. If you are not 
serviced properly, they have to eat one less. Now, go on and brush them 
off..


Kind regards,

Aschwin Wesselius


My last email to them said that if they don't do something soon, then
I'm going elsewhere, so I'll see if that spurs them on. I'm not into
naming and shaming, but if they don't get back to me on this at all,
then I feel a blog rant coming on!

Thanks,
Ash
http://www.ashleysheridan.co.uk


http://gophp5.org/hosts

Over 200 web hosts that have been committed to PHP 5.2 for at least 1.5 
years, in most cases over two years.  I am not affiliated with any of 
them directly.


--Larry Garfield

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



Re: [PHP] Re: problems with loaded extensions

2009-04-08 Thread Edgar da Silva (Fly2k)
Did you check the apache error log?

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



Re: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread Kyohere Luke
You might have something there - never really thought about how windows
forms the 8.3 names...  not many resources online about it ...

The actual path is c:\Program File\Gammu 1.23.91\bin\gammu.exe
I'd used c:\Progra~1\Gammu~1\bin\gammu.exe

Luke

On Thu, Mar 19, 2009 at 8:57 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 Kyohere Luke wrote:
  Hi,
 
  Tried all that - it'd work well until one of the arguments also had
 spaces
  and thus had  or '' encapsulating it - this weirdness is the reason for
  this post.
  Shawn, even the good old C:\pathwi~1\gammu.exe failed :-(

 Well, you didn't do it properly then.  What is the actual path?

 
  The only way I've gotten it to work was to get rid of the spaces in the
  path/to/exe.
 
  Luke.
 
  On Thu, Mar 19, 2009 at 8:24 PM, bruce bedoug...@earthlink.net wrote:
 
  hey...
 
  if you're going to deal with file/pathnames in windows/linux.. you're
 going
  to have to encapsulate them with  or with '' ie double/single
 quotes...
 
 
 
  -Original Message-
  From: Kyohere Luke [mailto:l...@beyonic.com]
  Sent: Thursday, March 19, 2009 10:18 AM
  To: Bastien Koert
  Cc: Shawn McKenzie; php-general@lists.php.net
  Subject: Re: [PHP] Re: Problems with exec() on windows
 
 
  Eventually settled for getting rid of the spaces in the path. That
 worked.
  Thanks.
  Luke
 
  On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com
 wrote:
 
 
  On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com
 wrote:
 
  Thanks, but I tried this. Doesn't work because the path\to\gammu.exe
 has
  spaces in it
  Haliphax, thanks for your comments. I tried escapeshellarg() to no
 end.
 
  I'm exploring your reply regarding proc_open, but how exactly does
  proc_open
  separate the arguments from the command?
 
  Unless i'm mistaken, data written to the process's stdin (for the
 other
  process) is not treated like an argument.
 
  If I add the arguments to the process name/path? I'm back to square
 one.
 
  Luke.
 
  On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
  wrote:
  Kyohere Luke wrote:
  Hi,
  I'm trying to use exec to call gammu.exe and send sms on windows XP.
 
  This works from commandline:
 
  C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
 
  But if I run it through php like this:
 
  $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
  test2\.;
  @exec($command, $response, $retval);
 
  This always fails, returns 1 and the response is empty.
 
  If the last argument is a string with no spaces, and the double
  quotes
  were
  omitted, it works perfectly.
 
  If the double quotes are added around the string with no spaces, it
  fails
  again, which makes me believe that the problem is with the double
  quotes.
  I've used procmon and it shows that when the double quotes are added
  around
  the last argument, gammu.exe is not even called at all.
 
  Problem is that the double quotes are required by gammu to send an
  sms
  with
  spaces in it.
 
  Any ideas? :-(
 
  Luke
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1
  test2';
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  try double slashes for the path and wrap the pathin quotes if there are
  spaces in it. Or if possible get rid of the spaces in the folder names
 
  --
 
  Bastien
 
  Cat, the other other white meat
 
 
 


 --
 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: Problems with exec() on windows

2009-03-20 Thread haliphax
On Fri, Mar 20, 2009 at 1:47 AM, Kyohere Luke pr0...@gmail.com wrote:
 You might have something there - never really thought about how windows
 forms the 8.3 names...  not many resources online about it ...

 The actual path is c:\Program File\Gammu 1.23.91\bin\gammu.exe
 I'd used c:\Progra~1\Gammu~1\bin\gammu.exe

You should be able to view these truncated path names via the dir
command in a CMD.EXE command line. I say this because Program Files
and Programs would collide with each other (just as an example); one
would be Progra~1 and one would be Progra~2.


-- 
// Todd

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



Re: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread George Larson
I've skimmed some of thread, but I have not been following closely so please
disregard if I'm just rambling.  However, I've worked with lots of software
on DOS boxen that couldn't handle long file names.  If they also choke on
the tildes then I usually just write a batch file that calls the full path
and file with whatever command line parameters I pass to the batch.

For example:
---

@echo off
C:\Program Files\Mozilla Firefox\firefox.exe %1 %2 %3

---
HTH,
G

On Fri, Mar 20, 2009 at 9:26 AM, haliphax halip...@gmail.com wrote:

 On Fri, Mar 20, 2009 at 1:47 AM, Kyohere Luke pr0...@gmail.com wrote:
  You might have something there - never really thought about how windows
  forms the 8.3 names...  not many resources online about it ...
 
  The actual path is c:\Program File\Gammu 1.23.91\bin\gammu.exe
  I'd used c:\Progra~1\Gammu~1\bin\gammu.exe

 You should be able to view these truncated path names via the dir
 command in a CMD.EXE command line. I say this because Program Files
 and Programs would collide with each other (just as an example); one
 would be Progra~1 and one would be Progra~2.


 --
 // Todd

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




RE: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread bruce
when dealing with windows.. or any file/pathname.. you can't simply
quote/double quote the name using the ~ symbol as well..

haven't done it for awhile.. but i believe you need to explode/derive the
complete path/filename and then quote/double quote it for use by the app...



-Original Message-
From: l...@beyonic.com [mailto:l...@beyonic.com]on Behalf Of Kyohere
Luke
Sent: Thursday, March 19, 2009 11:48 PM
To: Shawn McKenzie
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: Problems with exec() on windows


You might have something there - never really thought about how windows
forms the 8.3 names...  not many resources online about it ...

The actual path is c:\Program File\Gammu 1.23.91\bin\gammu.exe
I'd used c:\Progra~1\Gammu~1\bin\gammu.exe

Luke

On Thu, Mar 19, 2009 at 8:57 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 Kyohere Luke wrote:
  Hi,
 
  Tried all that - it'd work well until one of the arguments also had
 spaces
  and thus had  or '' encapsulating it - this weirdness is the reason
for
  this post.
  Shawn, even the good old C:\pathwi~1\gammu.exe failed :-(

 Well, you didn't do it properly then.  What is the actual path?

 
  The only way I've gotten it to work was to get rid of the spaces in the
  path/to/exe.
 
  Luke.
 
  On Thu, Mar 19, 2009 at 8:24 PM, bruce bedoug...@earthlink.net wrote:
 
  hey...
 
  if you're going to deal with file/pathnames in windows/linux.. you're
 going
  to have to encapsulate them with  or with '' ie double/single
 quotes...
 
 
 
  -Original Message-
  From: Kyohere Luke [mailto:l...@beyonic.com]
  Sent: Thursday, March 19, 2009 10:18 AM
  To: Bastien Koert
  Cc: Shawn McKenzie; php-general@lists.php.net
  Subject: Re: [PHP] Re: Problems with exec() on windows
 
 
  Eventually settled for getting rid of the spaces in the path. That
 worked.
  Thanks.
  Luke
 
  On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com
 wrote:
 
 
  On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com
 wrote:
 
  Thanks, but I tried this. Doesn't work because the path\to\gammu.exe
 has
  spaces in it
  Haliphax, thanks for your comments. I tried escapeshellarg() to no
 end.
 
  I'm exploring your reply regarding proc_open, but how exactly does
  proc_open
  separate the arguments from the command?
 
  Unless i'm mistaken, data written to the process's stdin (for the
 other
  process) is not treated like an argument.
 
  If I add the arguments to the process name/path? I'm back to square
 one.
 
  Luke.
 
  On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
  wrote:
  Kyohere Luke wrote:
  Hi,
  I'm trying to use exec to call gammu.exe and send sms on windows
XP.
 
  This works from commandline:
 
  C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
 
  But if I run it through php like this:
 
  $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text
\test1
  test2\.;
  @exec($command, $response, $retval);
 
  This always fails, returns 1 and the response is empty.
 
  If the last argument is a string with no spaces, and the double
  quotes
  were
  omitted, it works perfectly.
 
  If the double quotes are added around the string with no spaces, it
  fails
  again, which makes me believe that the problem is with the double
  quotes.
  I've used procmon and it shows that when the double quotes are
added
  around
  the last argument, gammu.exe is not even called at all.
 
  Problem is that the double quotes are required by gammu to send an
  sms
  with
  spaces in it.
 
  Any ideas? :-(
 
  Luke
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1
  test2';
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  try double slashes for the path and wrap the pathin quotes if there
are
  spaces in it. Or if possible get rid of the spaces in the folder names
 
  --
 
  Bastien
 
  Cat, the other other white meat
 
 
 


 --
 Thanks!
 -Shawn
 http://www.spidean.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



Re: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread Shawn McKenzie
Kyohere Luke wrote:
 You might have something there - never really thought about how windows
 forms the 8.3 names...  not many resources online about it ...
 
 The actual path is c:\Program File\Gammu 1.23.91\bin\gammu.exe
 I'd used c:\Progra~1\Gammu~1\bin\gammu.exe

You take the first 6 characters (ignoring spaces) and then add a tilde ~
and a number.  The number will increment for another directory
alphabetically after the one with the 1 if it reduces to the same 6
characters and so on.

Yours would most likely be: c:\Progra~1\Gammu1~1\bin\gammu.exe


Unless some other directory is alphabetically before one of those and
reduces to the same 6 characters.  For example if you have a c:\Program
or a c:\Program File\Gammu 1.111

I'm pretty sure the dir command will show you the 8.3 name.

-- 
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: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
spaces in it
Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

I'm exploring your reply regarding proc_open, but how exactly does proc_open
separate the arguments from the command?

Unless i'm mistaken, data written to the process's stdin (for the other
process) is not treated like an argument.

If I add the arguments to the process name/path? I'm back to square one.

Luke.

On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 Kyohere Luke wrote:
  Hi,
  I'm trying to use exec to call gammu.exe and send sms on windows XP.
 
  This works from commandline:
 
  C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
 
  But if I run it through php like this:
 
  $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
  test2\.;
  @exec($command, $response, $retval);
 
  This always fails, returns 1 and the response is empty.
 
  If the last argument is a string with no spaces, and the double quotes
 were
  omitted, it works perfectly.
 
  If the double quotes are added around the string with no spaces, it fails
  again, which makes me believe that the problem is with the double quotes.
 
  I've used procmon and it shows that when the double quotes are added
 around
  the last argument, gammu.exe is not even called at all.
 
  Problem is that the double quotes are required by gammu to send an sms
 with
  spaces in it.
 
  Any ideas? :-(
 
  Luke
 

 Why not try:

 $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1 test2';

 --
 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: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
spaces in it
Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

I'm exploring your reply regarding proc_open, but how exactly does proc_open
separate the arguments from the command?

Unless i'm mistaken, data written to the process's stdin (for the other
process) is not treated like an argument.

If I add the arguments to the process name/path? I'm back to square one.

Luke

On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 Kyohere Luke wrote:
  Hi,
  I'm trying to use exec to call gammu.exe and send sms on windows XP.
 
  This works from commandline:
 
  C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
 
  But if I run it through php like this:
 
  $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
  test2\.;
  @exec($command, $response, $retval);
 
  This always fails, returns 1 and the response is empty.
 
  If the last argument is a string with no spaces, and the double quotes
 were
  omitted, it works perfectly.
 
  If the double quotes are added around the string with no spaces, it fails
  again, which makes me believe that the problem is with the double quotes.
 
  I've used procmon and it shows that when the double quotes are added
 around
  the last argument, gammu.exe is not even called at all.
 
  Problem is that the double quotes are required by gammu to send an sms
 with
  spaces in it.
 
  Any ideas? :-(
 
  Luke
 

 Why not try:

 $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1 test2';

 --
 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: Problems with exec() on windows

2009-03-19 Thread Bastien Koert
On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:

 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

 I'm exploring your reply regarding proc_open, but how exactly does
 proc_open
 separate the arguments from the command?

 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.

 If I add the arguments to the process name/path? I'm back to square one.

 Luke.

 On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  Kyohere Luke wrote:
   Hi,
   I'm trying to use exec to call gammu.exe and send sms on windows XP.
  
   This works from commandline:
  
   C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
  
   But if I run it through php like this:
  
   $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
   test2\.;
   @exec($command, $response, $retval);
  
   This always fails, returns 1 and the response is empty.
  
   If the last argument is a string with no spaces, and the double quotes
  were
   omitted, it works perfectly.
  
   If the double quotes are added around the string with no spaces, it
 fails
   again, which makes me believe that the problem is with the double
 quotes.
  
   I've used procmon and it shows that when the double quotes are added
  around
   the last argument, gammu.exe is not even called at all.
  
   Problem is that the double quotes are required by gammu to send an sms
  with
   spaces in it.
  
   Any ideas? :-(
  
   Luke
  
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1 test2';
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


try double slashes for the path and wrap the pathin quotes if there are
spaces in it. Or if possible get rid of the spaces in the folder names

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Eventually settled for getting rid of the spaces in the path. That worked.
Thanks.
Luke

On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:



 On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:

 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

 I'm exploring your reply regarding proc_open, but how exactly does
 proc_open
 separate the arguments from the command?

 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.

 If I add the arguments to the process name/path? I'm back to square one.

 Luke.

 On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  Kyohere Luke wrote:
   Hi,
   I'm trying to use exec to call gammu.exe and send sms on windows XP.
  
   This works from commandline:
  
   C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
  
   But if I run it through php like this:
  
   $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
   test2\.;
   @exec($command, $response, $retval);
  
   This always fails, returns 1 and the response is empty.
  
   If the last argument is a string with no spaces, and the double quotes
  were
   omitted, it works perfectly.
  
   If the double quotes are added around the string with no spaces, it
 fails
   again, which makes me believe that the problem is with the double
 quotes.
  
   I've used procmon and it shows that when the double quotes are added
  around
   the last argument, gammu.exe is not even called at all.
  
   Problem is that the double quotes are required by gammu to send an sms
  with
   spaces in it.
  
   Any ideas? :-(
  
   Luke
  
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1 test2';
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 try double slashes for the path and wrap the pathin quotes if there are
 spaces in it. Or if possible get rid of the spaces in the folder names

 --

 Bastien

 Cat, the other other white meat



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Shawn McKenzie
Kyohere Luke wrote:
 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
 
 I'm exploring your reply regarding proc_open, but how exactly does proc_open
 separate the arguments from the command?
 
 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.
 
 If I add the arguments to the process name/path? I'm back to square one.
 
 Luke
 
Well, I don't think you stated that at first, on the text message had
spaces.  Try:

$command = 'C:\path with spaces\gammu.exe --sendsms EMS 200 -text
test1 test2';

If not, you can use the good old:

$command = 'C:\pathwi~1\gammu.exe --sendsms EMS 200 -text test1 test2';


-- 
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: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Eventually settled for getting rid of the spaces in the path. That worked.
Thanks.
Luke

On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:



 On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:

 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

 I'm exploring your reply regarding proc_open, but how exactly does
 proc_open
 separate the arguments from the command?

 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.

 If I add the arguments to the process name/path? I'm back to square one.

 Luke.

 On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  Kyohere Luke wrote:
   Hi,
   I'm trying to use exec to call gammu.exe and send sms on windows XP.
  
   This works from commandline:
  
   C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
  
   But if I run it through php like this:
  
   $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
   test2\.;
   @exec($command, $response, $retval);
  
   This always fails, returns 1 and the response is empty.
  
   If the last argument is a string with no spaces, and the double quotes
  were
   omitted, it works perfectly.
  
   If the double quotes are added around the string with no spaces, it
 fails
   again, which makes me believe that the problem is with the double
 quotes.
  
   I've used procmon and it shows that when the double quotes are added
  around
   the last argument, gammu.exe is not even called at all.
  
   Problem is that the double quotes are required by gammu to send an sms
  with
   spaces in it.
  
   Any ideas? :-(
  
   Luke
  
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1 test2';
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 try double slashes for the path and wrap the pathin quotes if there are
 spaces in it. Or if possible get rid of the spaces in the folder names

 --

 Bastien

 Cat, the other other white meat



RE: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread bruce
hey...

if you're going to deal with file/pathnames in windows/linux.. you're going
to have to encapsulate them with  or with '' ie double/single quotes...



-Original Message-
From: Kyohere Luke [mailto:l...@beyonic.com]
Sent: Thursday, March 19, 2009 10:18 AM
To: Bastien Koert
Cc: Shawn McKenzie; php-general@lists.php.net
Subject: Re: [PHP] Re: Problems with exec() on windows


Eventually settled for getting rid of the spaces in the path. That worked.
Thanks.
Luke

On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:



 On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:

 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

 I'm exploring your reply regarding proc_open, but how exactly does
 proc_open
 separate the arguments from the command?

 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.

 If I add the arguments to the process name/path? I'm back to square one.

 Luke.

 On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  Kyohere Luke wrote:
   Hi,
   I'm trying to use exec to call gammu.exe and send sms on windows XP.
  
   This works from commandline:
  
   C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
  
   But if I run it through php like this:
  
   $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
   test2\.;
   @exec($command, $response, $retval);
  
   This always fails, returns 1 and the response is empty.
  
   If the last argument is a string with no spaces, and the double
quotes
  were
   omitted, it works perfectly.
  
   If the double quotes are added around the string with no spaces, it
 fails
   again, which makes me believe that the problem is with the double
 quotes.
  
   I've used procmon and it shows that when the double quotes are added
  around
   the last argument, gammu.exe is not even called at all.
  
   Problem is that the double quotes are required by gammu to send an
sms
  with
   spaces in it.
  
   Any ideas? :-(
  
   Luke
  
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1
test2';
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 try double slashes for the path and wrap the pathin quotes if there are
 spaces in it. Or if possible get rid of the spaces in the folder names

 --

 Bastien

 Cat, the other other white meat



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



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Hi,

Tried all that - it'd work well until one of the arguments also had spaces
and thus had  or '' encapsulating it - this weirdness is the reason for
this post.
Shawn, even the good old C:\pathwi~1\gammu.exe failed :-(

The only way I've gotten it to work was to get rid of the spaces in the
path/to/exe.

Luke.

On Thu, Mar 19, 2009 at 8:24 PM, bruce bedoug...@earthlink.net wrote:

 hey...

 if you're going to deal with file/pathnames in windows/linux.. you're going
 to have to encapsulate them with  or with '' ie double/single quotes...



 -Original Message-
 From: Kyohere Luke [mailto:l...@beyonic.com]
 Sent: Thursday, March 19, 2009 10:18 AM
 To: Bastien Koert
 Cc: Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] Re: Problems with exec() on windows


 Eventually settled for getting rid of the spaces in the path. That worked.
 Thanks.
 Luke

 On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:

 
 
  On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:
 
  Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
  spaces in it
  Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
 
  I'm exploring your reply regarding proc_open, but how exactly does
  proc_open
  separate the arguments from the command?
 
  Unless i'm mistaken, data written to the process's stdin (for the other
  process) is not treated like an argument.
 
  If I add the arguments to the process name/path? I'm back to square one.
 
  Luke.
 
  On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
  wrote:
 
   Kyohere Luke wrote:
Hi,
I'm trying to use exec to call gammu.exe and send sms on windows XP.
   
This works from commandline:
   
C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
   
But if I run it through php like this:
   
$command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
test2\.;
@exec($command, $response, $retval);
   
This always fails, returns 1 and the response is empty.
   
If the last argument is a string with no spaces, and the double
 quotes
   were
omitted, it works perfectly.
   
If the double quotes are added around the string with no spaces, it
  fails
again, which makes me believe that the problem is with the double
  quotes.
   
I've used procmon and it shows that when the double quotes are added
   around
the last argument, gammu.exe is not even called at all.
   
Problem is that the double quotes are required by gammu to send an
 sms
   with
spaces in it.
   
Any ideas? :-(
   
Luke
   
  
   Why not try:
  
   $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1
 test2';
  
   --
   Thanks!
   -Shawn
   http://www.spidean.com
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
  try double slashes for the path and wrap the pathin quotes if there are
  spaces in it. Or if possible get rid of the spaces in the folder names
 
  --
 
  Bastien
 
  Cat, the other other white meat
 




Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Hi,

Tried all that - it'd work well until one of the arguments also had spaces
and thus had  or '' encapsulating it - this weirdness is the reason for
this post.
Shawn, even the good old C:\pathwi~1\gammu.exe failed :-(

The only way I've gotten it to work was to get rid of the spaces in the
path/to/exe.

Luke

On Thu, Mar 19, 2009 at 8:24 PM, bruce bedoug...@earthlink.net wrote:

 hey...

 if you're going to deal with file/pathnames in windows/linux.. you're going
 to have to encapsulate them with  or with '' ie double/single quotes...



 -Original Message-
 From: Kyohere Luke [mailto:l...@beyonic.com]
 Sent: Thursday, March 19, 2009 10:18 AM
 To: Bastien Koert
 Cc: Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] Re: Problems with exec() on windows


 Eventually settled for getting rid of the spaces in the path. That worked.
 Thanks.
 Luke

 On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:

 
 
  On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:
 
  Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
  spaces in it
  Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
 
  I'm exploring your reply regarding proc_open, but how exactly does
  proc_open
  separate the arguments from the command?
 
  Unless i'm mistaken, data written to the process's stdin (for the other
  process) is not treated like an argument.
 
  If I add the arguments to the process name/path? I'm back to square one.
 
  Luke.
 
  On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
  wrote:
 
   Kyohere Luke wrote:
Hi,
I'm trying to use exec to call gammu.exe and send sms on windows XP.
   
This works from commandline:
   
C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
   
But if I run it through php like this:
   
$command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
test2\.;
@exec($command, $response, $retval);
   
This always fails, returns 1 and the response is empty.
   
If the last argument is a string with no spaces, and the double
 quotes
   were
omitted, it works perfectly.
   
If the double quotes are added around the string with no spaces, it
  fails
again, which makes me believe that the problem is with the double
  quotes.
   
I've used procmon and it shows that when the double quotes are added
   around
the last argument, gammu.exe is not even called at all.
   
Problem is that the double quotes are required by gammu to send an
 sms
   with
spaces in it.
   
Any ideas? :-(
   
Luke
   
  
   Why not try:
  
   $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1
 test2';
  
   --
   Thanks!
   -Shawn
   http://www.spidean.com
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
  try double slashes for the path and wrap the pathin quotes if there are
  spaces in it. Or if possible get rid of the spaces in the folder names
 
  --
 
  Bastien
 
  Cat, the other other white meat
 




Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Shawn McKenzie
Kyohere Luke wrote:
 Hi,
 
 Tried all that - it'd work well until one of the arguments also had spaces
 and thus had  or '' encapsulating it - this weirdness is the reason for
 this post.
 Shawn, even the good old C:\pathwi~1\gammu.exe failed :-(

Well, you didn't do it properly then.  What is the actual path?

 
 The only way I've gotten it to work was to get rid of the spaces in the
 path/to/exe.
 
 Luke.
 
 On Thu, Mar 19, 2009 at 8:24 PM, bruce bedoug...@earthlink.net wrote:
 
 hey...

 if you're going to deal with file/pathnames in windows/linux.. you're going
 to have to encapsulate them with  or with '' ie double/single quotes...



 -Original Message-
 From: Kyohere Luke [mailto:l...@beyonic.com]
 Sent: Thursday, March 19, 2009 10:18 AM
 To: Bastien Koert
 Cc: Shawn McKenzie; php-general@lists.php.net
 Subject: Re: [PHP] Re: Problems with exec() on windows


 Eventually settled for getting rid of the spaces in the path. That worked.
 Thanks.
 Luke

 On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:


 On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:

 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

 I'm exploring your reply regarding proc_open, but how exactly does
 proc_open
 separate the arguments from the command?

 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.

 If I add the arguments to the process name/path? I'm back to square one.

 Luke.

 On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:
 Kyohere Luke wrote:
 Hi,
 I'm trying to use exec to call gammu.exe and send sms on windows XP.

 This works from commandline:

 C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2

 But if I run it through php like this:

 $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
 test2\.;
 @exec($command, $response, $retval);

 This always fails, returns 1 and the response is empty.

 If the last argument is a string with no spaces, and the double
 quotes
 were
 omitted, it works perfectly.

 If the double quotes are added around the string with no spaces, it
 fails
 again, which makes me believe that the problem is with the double
 quotes.
 I've used procmon and it shows that when the double quotes are added
 around
 the last argument, gammu.exe is not even called at all.

 Problem is that the double quotes are required by gammu to send an
 sms
 with
 spaces in it.

 Any ideas? :-(

 Luke

 Why not try:

 $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1
 test2';
 --
 Thanks!
 -Shawn
 http://www.spidean.com

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


 try double slashes for the path and wrap the pathin quotes if there are
 spaces in it. Or if possible get rid of the spaces in the folder names

 --

 Bastien

 Cat, the other other white meat


 


-- 
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: Problems with exec() on windows

2009-03-19 Thread Frank Stanovcak

Kyohere Luke l...@beyonic.com wrote in message 
news:9bc423c50903191018k3c783213l4929cf2878e98...@mail.gmail.com...
 Eventually settled for getting rid of the spaces in the path. That worked.
 Thanks.
 Luke

 On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert phps...@gmail.com wrote:



 On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke l...@beyonic.com wrote:

 Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
 spaces in it
 Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

 I'm exploring your reply regarding proc_open, but how exactly does
 proc_open
 separate the arguments from the command?

 Unless i'm mistaken, data written to the process's stdin (for the other
 process) is not treated like an argument.

 If I add the arguments to the process name/path? I'm back to square one.

 Luke.

 On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

  Kyohere Luke wrote:
   Hi,
   I'm trying to use exec to call gammu.exe and send sms on windows XP.
  
   This works from commandline:
  
   C:\path\to\gammu.exe 1 --sendsms EMS 200 -text test1 test2
  
   But if I run it through php like this:
  
   $command = \C:\path\to\gammu.exe\ --sendsms EMS 200 -text \test1
   test2\.;
   @exec($command, $response, $retval);
  
   This always fails, returns 1 and the response is empty.
  
   If the last argument is a string with no spaces, and the double 
   quotes
  were
   omitted, it works perfectly.
  
   If the double quotes are added around the string with no spaces, it
 fails
   again, which makes me believe that the problem is with the double
 quotes.
  
   I've used procmon and it shows that when the double quotes are added
  around
   the last argument, gammu.exe is not even called at all.
  
   Problem is that the double quotes are required by gammu to send an 
   sms
  with
   spaces in it.
  
   Any ideas? :-(
  
   Luke
  
 
  Why not try:
 
  $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text test1 
  test2';
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 try double slashes for the path and wrap the pathin quotes if there are
 spaces in it. Or if possible get rid of the spaces in the folder names

 --

 Bastien

 Cat, the other other white meat



Rule of thumb.  Since PHP is for web access try to avoid spaces in any 
folder names you will be making accessable through either the site or php 
references.  It makes life much much easier.


Frank.  Back from his binge drinking, and School applications after his 
layoff. 



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



Re: [PHP] Re: Problems with displaying results

2009-03-03 Thread Kyle Terry
On Tue, Mar 3, 2009 at 8:32 AM, Shawn McKenzie nos...@mckenzies.net wrote:

 Terion Miller wrote:
  I have two queries one pulls out which users to use and the second pulls
  those users orders
  Looks something like this but is only pulling the first record:
 
 
  $query =  SELECT `UserName`, `AdminID` FROM admin
WHERE   Key1 =  'YES' ;
 
  $result = mysql_query ($query) ;
  $row = mysql_fetch_assoc($result);
 
  //Reveal Variables for Debugging
  // include(VariableReveal2.php);
   echo (Hello br);
  //echo $row['AdminID'];
  echo ($row['UserName']);
 
 
 
 
  if ($row['Key1'] == NO) {
  header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
  not have access to that page.);
  }
 
  if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
  'WorkOrderID DESC';}
  if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
  $PerPage = 30;
  $StartPage = ($Page - 1) * $PerPage;
 
  second query here is using the $row from the first (and yes I
 know
  not to use *, just did so here to keep post shorter)
 
   $sql= SELECT * FROM workorders WHERE AdminID =
  '.$row['AdminID'].' ;
// $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
$result = mysql_query ($sql);
$row2 = mysql_fetch_assoc($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
  So this works but only half way as it only displays the first record
 in
  the table.
 
 
 
 
  Thanks
  Terion
 
  Happy Freecycling
  Free the List !!
  www.freecycle.org
  Over Moderation of Freecycle List Prevents Post Timeliness.
  
  Twitter?
  http://twitter.com/terionmiller
  
  Facebook:
  a href=http://www.facebook.com/people/Terion-Miller/1542024891;
  title=Terion Miller's Facebook profile target=_TOPimg src=
  http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
  alt=Terion Miller's Facebook profile/a
  Groucho Marx  - I have had a perfectly wonderful evening, but this
 wasn't
  it.
 

 You need to lookup the mysql_fetch_assoc() function.  It only returns
 one row from a result set that may contain multiple rows.  You need
 something like:

 while($row = mysql_fetch_assoc($result)) {
  // do something with $row
 }

 --
 Thanks!
 -Shawn
 http://www.spidean.com

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

 You also need to filter your user inputted data.


Kyle Terry | www.kyleterry.com
Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
http://www.voom.me | IRC EFNet #voom


RE: [PHP] Installation problems on Vista

2009-01-20 Thread lucson pierre-charles

TG,
 I configured it as follows but will still not work. 
 
These are the lines I added to the modules section:
#LoadModule php5_module c:/php5/php5apache2.dll#AddType application/x-httpd-php 
.php#PHPIniDir c:/php5
 
I added these lines to the DirectoryIndex:
DirectoryIndex index.html index.html.var index.php
 
Lucson From: tg-...@gryffyndevelopment.com To: lucsonpie...@hotmail.com; 
php-general@lists.php.net Date: Mon, 19 Jan 2009 18:35:08 -0500 Subject: Re: 
[PHP] Installation problems on Vista  You most likely need to configure 
Apache to process PHP script files. Check  out this page:  
http://www.ampsoft.net/webdesign-l/how-to-install-apache-php-mysql-3.html  
-TG  - Original Message - From: lucson pierre-charles 
lucsonpie...@hotmail.com To: php-general@lists.php.net Date: Mon, 19 Jan 
2009 22:37:25 + Subject: [PHP] Installation problems on Vista I 
am having problems installing the zip package (PHP5) on Windows Vista.  The 
output will not come on the browser upon testing. Only the code is  being 
output to the browser. Apache (Apache 2) was properly installed. Your  
assistance please. Regards, Lucson--  PHP General Mailing List 
(http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 

Re: [PHP] Installation problems on Vista

2009-01-19 Thread Chris

lucson pierre-charles wrote:

I am having problems installing the zip package (PHP5) on Windows Vista. The 
output will not come on the browser upon testing. Only the code is being output 
to the browser. Apache (Apache 2) was properly installed. Your assistance 
please. Regards, Lucson


If you're seeing the php code, apache isn't interpreting it at all (it 
doesn't know what to do with .php files yet).


http://www.php.net/manual/en/install.windows.apache2.php

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Installation problems on Vista

2009-01-19 Thread TG
You most likely need to configure Apache to process PHP script files.  Check 
out this page:

http://www.ampsoft.net/webdesign-l/how-to-install-apache-php-mysql-3.html

-TG

- Original Message -
From: lucson pierre-charles lucsonpie...@hotmail.com
To: php-general@lists.php.net
Date: Mon, 19 Jan 2009 22:37:25 +
Subject: [PHP] Installation problems on Vista

 
 I am having problems installing the zip package (PHP5) on Windows Vista. 
The output will not come on the browser upon testing. Only the code is 
being output to the browser. Apache (Apache 2) was properly installed. Your 
assistance please. Regards, Lucson
 

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



Re: [PHP] Math problems (No not high school math!)

2008-09-25 Thread Stephen

Jason Pruim wrote:
So I'm trying to figure out how to do a little math in php to add up 
the number of hours that people have worked (Still on the timecard for 
anyone following along at home)


I have it inserting time in and timeout as timestamps into a MySQL 
database, from there, I use a while loop to display the total hours 
for the day which works perfectly, now though, they want it to total 
for the week...


Consider adding a column for the total hours and calculate it when 
saving the record.


It should make everything that follows easier.

Stephen

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



Re: [PHP] Math problems (No not high school math!)

2008-09-25 Thread Jim Lucas
Jason Pruim wrote:
 So I'm trying to figure out how to do a little math in php to add up the
 number of hours that people have worked (Still on the timecard for
 anyone following along at home)
 
 I have it inserting time in and timeout as timestamps into a MySQL
 database, from there, I use a while loop to display the total hours for
 the day which works perfectly, now though, they want it to total for the
 week...
 
 I think what I need to do is create an array of my total time for the
 day then add that up in another loop to display the total... That seems
 like overkill to me though... is there a better way to do it?
 
 Here is the relevant part of the code:
 
 while ($row = mysql_fetch_assoc($result)){
 $timein = date(m/d/y h:i:s, $row['timein']);
 $timeout = date(m/d/y h:i:s, $row['timeout']);
 $totalday = ($row['timeout'] - $row['timein']);
 $totalday = $totalday/60/60;
 $totalday = round($totalday, 2);
 $totalweek = [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
 PROTECTED]@#?#$*^

 echo ADMIN


 tr
 td{$row['Name']}/td
 td{$timein}/td
 td{$timeout}/td
 td{$totalday}/td

 /tr

 ADMIN;
 }   
 echo /table
 /div
 /body;
 
 -- 
 
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]
 
 
 
 
 

Doesn't seem logical to have the weekly total displayed at the end of each
day.  Are you wanting a subtotal of each day being added to the weekly total
to be displayed next to each day?  If that is the case, the just have one
variable that you add each days total to that doesn't get reset when the new
DAY is started.

-- 
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] Math problems (No not high school math!)

2008-09-25 Thread Jason Pruim


On Sep 25, 2008, at 11:28 AM, Jim Lucas wrote:


Jason Pruim wrote:
So I'm trying to figure out how to do a little math in php to add  
up the

number of hours that people have worked (Still on the timecard for
anyone following along at home)

I have it inserting time in and timeout as timestamps into a MySQL
database, from there, I use a while loop to display the total hours  
for
the day which works perfectly, now though, they want it to total  
for the

week...

I think what I need to do is create an array of my total time for the
day then add that up in another loop to display the total... That  
seems

like overkill to me though... is there a better way to do it?

Here is the relevant part of the code:

while ($row = mysql_fetch_assoc($result)){
   $timein = date(m/d/y h:i:s, $row['timein']);
   $timeout = date(m/d/y h:i:s, $row['timeout']);
   $totalday = ($row['timeout'] - $row['timein']);
   $totalday = $totalday/60/60;
   $totalday = round($totalday, 2);
   $totalweek = [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@#?#$*^

   echo ADMIN


   tr
   td{$row['Name']}/td
   td{$timein}/td
   td{$timeout}/td
   td{$totalday}/td

   /tr

ADMIN;
   }
   echo /table
   /div
   /body;

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]







Doesn't seem logical to have the weekly total displayed at the end  
of each
day.  Are you wanting a subtotal of each day being added to the  
weekly total
to be displayed next to each day?  If that is the case, the just  
have one
variable that you add each days total to that doesn't get reset when  
the new

DAY is started.



Hi Jim,

You are correct, I want it to look something like this:
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
TOTAL FOR WEEK: X





--
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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Math problems (No not high school math!)

2008-09-25 Thread Jim Lucas
Jason Pruim wrote:
 
 On Sep 25, 2008, at 11:28 AM, Jim Lucas wrote:
 
 Jason Pruim wrote:
 So I'm trying to figure out how to do a little math in php to add up the
 number of hours that people have worked (Still on the timecard for
 anyone following along at home)

 I have it inserting time in and timeout as timestamps into a MySQL
 database, from there, I use a while loop to display the total hours for
 the day which works perfectly, now though, they want it to total for the
 week...

 I think what I need to do is create an array of my total time for the
 day then add that up in another loop to display the total... That seems
 like overkill to me though... is there a better way to do it?

 Here is the relevant part of the code:

 while ($row = mysql_fetch_assoc($result)){
$timein = date(m/d/y h:i:s, $row['timein']);
$timeout = date(m/d/y h:i:s, $row['timeout']);
$totalday = ($row['timeout'] - $row['timein']);
$totalday = $totalday/60/60;
$totalday = round($totalday, 2);
$totalweek = [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
 PROTECTED]@#?#$*^

echo ADMIN


tr
td{$row['Name']}/td
td{$timein}/td
td{$timeout}/td
td{$totalday}/td

/tr

 ADMIN;
}
echo /table
/div
/body;

 -- 

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]






 Doesn't seem logical to have the weekly total displayed at the end of
 each
 day.  Are you wanting a subtotal of each day being added to the weekly
 total
 to be displayed next to each day?  If that is the case, the just have one
 variable that you add each days total to that doesn't get reset when
 the new
 DAY is started.
 
 
 Hi Jim,
 
 You are correct, I want it to look something like this:
 Name | time in | timeout | total for day
 Name | time in | timeout | total for day
 Name | time in | timeout | total for day
 Name | time in | timeout | total for day
 Name | time in | timeout | total for day
 Name | time in | timeout | total for day
 Name | time in | timeout | total for day
 TOTAL FOR WEEK: X
 
 


 -- 
 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


 
 -- 
 
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]
 
 
 
 
 

This should work for you.

$totalWeek = 0;  // Initialize total holder

while ($row = mysql_fetch_assoc($result)){
$timein = date(m/d/y h:i:s, $row['timein']);
$timeout = date(m/d/y h:i:s, $row['timeout']);
$totalday = ($row['timeout'] - $row['timein']);
$totalday = $totalday/60/60;
$totalday = round($totalday, 2);

$totalWeek += totalday;  // Builds the total from the daily total

echo ADMIN


tr
td{$row['Name']}/td
td{$timein}/td
td{$timeout}/td
td{$totalday}/td

/tr

ADMIN;
}

# Display Weekly total
echo WEEKTOTAL

tr
td colspan='4' align='right'TOTAL FOR WEEK: {$totalWeek}/td
/tr

WEEKTOTAL;

echo /table
/div
/body;

-- 
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare


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



RE: [PHP] Math problems (No not high school math!)

2008-09-25 Thread Simcha


 -Original Message-
 From: Jason Pruim [mailto:[EMAIL PROTECTED]
 Subject: [PHP] Math problems (No not high school math!)
 
 So I'm trying to figure out how to do a little math in php to add up
 the number of hours that people have worked (Still on the timecard for
 anyone following along at home)

Something like this should work:
Select SUM(timediff(`timeout`, `timein`)) where date = X;
And for a week:
Select SUM(timediff(`timeout`, `timein`)) where week(date) = week_of_year ;

(Not tested)


Simcha Younger




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



Re: [PHP] Math problems (No not high school math!)

2008-09-25 Thread Jason Pruim


On Sep 25, 2008, at 11:44 AM, Jim Lucas wrote:


Jason Pruim wrote:


On Sep 25, 2008, at 11:28 AM, Jim Lucas wrote:


Jason Pruim wrote:
So I'm trying to figure out how to do a little math in php to add  
up the

number of hours that people have worked (Still on the timecard for
anyone following along at home)

I have it inserting time in and timeout as timestamps into a MySQL
database, from there, I use a while loop to display the total  
hours for
the day which works perfectly, now though, they want it to total  
for the

week...

I think what I need to do is create an array of my total time for  
the
day then add that up in another loop to display the total... That  
seems

like overkill to me though... is there a better way to do it?

Here is the relevant part of the code:

while ($row = mysql_fetch_assoc($result)){
  $timein = date(m/d/y h:i:s, $row['timein']);
  $timeout = date(m/d/y h:i:s, $row['timeout']);
  $totalday = ($row['timeout'] - $row['timein']);
  $totalday = $totalday/60/60;
  $totalday = round($totalday, 2);
  $totalweek = [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@#?#$*^

  echo ADMIN


  tr
  td{$row['Name']}/td
  td{$timein}/td
  td{$timeout}/td
  td{$totalday}/td

  /tr

ADMIN;
  }
  echo /table
  /div
  /body;

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]







Doesn't seem logical to have the weekly total displayed at the end  
of

each
day.  Are you wanting a subtotal of each day being added to the  
weekly

total
to be displayed next to each day?  If that is the case, the just  
have one

variable that you add each days total to that doesn't get reset when
the new
DAY is started.



Hi Jim,

You are correct, I want it to look something like this:
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
Name | time in | timeout | total for day
   TOTAL FOR WEEK: X





--
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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]







This should work for you.

$totalWeek = 0;  // Initialize total holder

while ($row = mysql_fetch_assoc($result)){
   $timein = date(m/d/y h:i:s, $row['timein']);
   $timeout = date(m/d/y h:i:s, $row['timeout']);
   $totalday = ($row['timeout'] - $row['timein']);
   $totalday = $totalday/60/60;
   $totalday = round($totalday, 2);

   $totalWeek += totalday;  // Builds the total from the  
daily total


   echo ADMIN


   tr
   td{$row['Name']}/td
   td{$timein}/td
   td{$timeout}/td
   td{$totalday}/td

   /tr

ADMIN;
   }

# Display Weekly total
echo WEEKTOTAL

   tr
   td colspan='4' align='right'TOTAL FOR WEEK:  
{$totalWeek}/td

   /tr

WEEKTOTAL;

   echo /table
   /div
   /body;

Hi Everyone,

Just letting you all know (And for the archives) that I decided to use  
Jim's solution provided above. It works perfectly for what I am  
attempting to do.


Thanks to everyone for their help!


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



RE: [PHP] Math problems (No not high school math!)

2008-09-25 Thread Richard Lynch
Run another query and let MySQL add it up.

 -Original Message-
 From: Jason Pruim [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 25, 2008 10:05 AM
 To: PHP General List
 Subject: [PHP] Math problems (No not high school math!)

 So I'm trying to figure out how to do a little math in php to add up
 the number of hours that people have worked (Still on the timecard for
 anyone following along at home)

 I have it inserting time in and timeout as timestamps into a MySQL
 database, from there, I use a while loop to display the total hours
 for the day which works perfectly, now though, they want it to total
 for the week...

 I think what I need to do is create an array of my total time for the
 day then add that up in another loop to display the total... That
 seems like overkill to me though... is there a better way to do it?

 Here is the relevant part of the code:

 while ($row = mysql_fetch_assoc($result)){
 $timein = date(m/d/y h:i:s, $row['timein']);
 $timeout = date(m/d/y h:i:s,
 $row['timeout']);
 $totalday = ($row['timeout'] - $row['timein']);
 $totalday = $totalday/60/60;
 $totalday = round($totalday, 2);
 $totalweek =
 [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@#?#$*^

 echo ADMIN


 tr
 td{$row['Name']}/td
 td{$timein}/td
 td{$timeout}/td
 td{$totalday}/td

 /tr

 ADMIN;
 }
 echo /table
 /div
 /body;

 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]





___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214

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



Re: [PHP] Unicode problems

2008-09-25 Thread Chris

Thiago H. Pojda wrote:

This is slightly OT but I honestly don't know what else I can do.

I was asked to migrate a website from diff hosts. Okay, pretty easy, right?
Well, as usual, it wasn't.

Site pages content type was ISO-8559-1 and it was developed for a MySQL5
database that used latin1 as charset and InnoDB as storage system. Pretty
normal and ran smoothly.

The client database is a old 4.0 MySQL that (I'm not sure if they're just
disabled but it) doesn't have InnoDB and latin1. So I'm stuck with MyISAM
and UTF8. No, they can't change it - their hosting want them to migrate to
MSSQL and they can't switch hosts for whatever reason.


Tried either of these?

http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html
http://forums.mysql.com/read.php?10,52929,56552#msg-56552

--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Include problems

2008-04-14 Thread Daniel Brown
On Sat, Apr 12, 2008 at 11:06 PM, Bojan Tesanovic [EMAIL PROTECTED] wrote:

  On Apr 12, 2008, at 8:28 AM, GoWtHaM NaRiSiPaLli wrote:


  if(file_exists(../common/config.ini)) {
   $configData = parse_ini_file(../common/config.ini);
  } else {
 


  Try changing above code so it reads


  if(file_exists(common/config.ini)) {
   $configData = parse_ini_file(common/config.ini);
  } else {

In your primary file, you could also consider adding:

?php
$base_path = dirname(__FILE__);
?

And then, all includes from within that file would be included as such:

?php
include($base_path.'/common/config.ini');
?

Finally, on a different note, it may not be in your best interest
to keep a .ini extension on a configuration file, since this is
generally readable on the web.

-- 
/Daniel P. Brown
Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!

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



Re: [PHP] Include problems

2008-04-12 Thread Bojan Tesanovic


On Apr 12, 2008, at 8:28 AM, GoWtHaM NaRiSiPaLli wrote:


if(file_exists(../common/config.ini)) {
  $configData = parse_ini_file(../common/config.ini);
} else {



Try changing above code so it reads

if(file_exists(common/config.ini)) {
  $configData = parse_ini_file(common/config.ini);
} else {


As the xyz.php is in

/var/www/sites/project/  folder , and  that is the starting path of  
the script


so any script that needs to include
/var/www/sites/project/common/someFile.php
you need to specify relative path to '/var/www/sites/project/'  which  
is 'common/someFile.php'


this should work unless some of included files uses 'chdir'  function  
that changes current directory




Igor Jocic
http://www.carster.us/ Used Car Classifieds






Re: [PHP] \n problems when creating an email

2008-02-14 Thread Richard Lynch
If the recipient is gmail, then you need to use \r\n because Gmail is
following in the Windows way of ignoring standards... :-(

On Mon, February 11, 2008 6:10 am, Angelo Zanetti wrote:
 Hi guys,

 I am making email text based on some fields the user fills in and then
 email
 the admin the details.

 I am having a problem where sometimes the \n (new line) works and
 sometimes
 it just does nothing. Im not sure the cause but I cant seem to figure
 it
 out.

 Here is a segment of code:

   .\nHow far would they be
 prepared to travel to 
   .\n event venue?
 \n\t\t\t\t\t.  $travel

   .\nDo you have a specific
 location 
   . \n of preference?
 \n\t\t\t\t\t.  $locationPref
   .\n City or country
 preference:\t.  $cityPref


 Here is the output:

 How far would they be prepared to travel to  event venue?
   Z Logic e Business Cape
 Do you have a specific location
  of preference?
   Z Logic e Business Cape
  City or country preference:  Z Logic e Business Cape


 As you can see the first line doesn't go to the next row before
 event

 But it works fine for the location \n preference

 Is there any reason it works for the 1 piece of code and not the next?
 Do
 spaces affect anything?


 Kind regards,
 Angelo Zanetti
 Application Developer
 


 Telephone: +27 (021) 552 9799
 Mobile:   +27 (0) 72 441 3355
 Fax:+27 (0) 86 681 5885

 Web: http://www.elemental.co.za
 E-Mail: [EMAIL PROTECTED]

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] \n problems when creating an email

2008-02-11 Thread Wolf
I've found it to be a lost cause to add pure white space in tabs during emails. 
 Most clients are helpful in making things user friendly by removing 
leading white space.  What i found did work on most machines at the time was 
either just a newline or a Q: question\nA: answer\n which isn't as 
formatted, but does the readabilty job.

Wolf

-Original Message-
From: Angelo Zanetti [EMAIL PROTECTED]
Sent: Monday, February 11, 2008 7:23 AM
To: 'Stut' [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: RE: [PHP] \n problems when creating an email


Looks like you're using Outlook. It has an annoying feature where it 
helpfully removes extra line breaks. This would appear to be what's 
happening here.

When it does this it usually displays a notice somewhere to say it's 
done this and offers a way to undo it.



Thanks, dam I been wasting my time trying to figure out the solution...

However I see that with the tabbed (\t) formatting its very inconsistent in
many email and web clients... Do you have a solution to ensure that the
output is consistent always?

Please send some links or any advice, TIA

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

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



Re: [PHP] \n problems when creating an email

2008-02-11 Thread Nathan Rixham

exactly as stut said, try using double /n's or convert the email to html.

whilst testing always view email source to verify what your creating.

Nath

Stut wrote:

Angelo Zanetti wrote:
I am making email text based on some fields the user fills in and then 
email

the admin the details.

I am having a problem where sometimes the \n (new line) works and 
sometimes

it just does nothing. Im not sure the cause but I cant seem to figure it
out.


Looks like you're using Outlook. It has an annoying feature where it 
helpfully removes extra line breaks. This would appear to be what's 
happening here.


When it does this it usually displays a notice somewhere to say it's 
done this and offers a way to undo it.


-Stut


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



Re: [PHP] \n problems when creating an email

2008-02-11 Thread Stut

Angelo Zanetti wrote:

I am making email text based on some fields the user fills in and then email
the admin the details.

I am having a problem where sometimes the \n (new line) works and sometimes
it just does nothing. Im not sure the cause but I cant seem to figure it
out.


Looks like you're using Outlook. It has an annoying feature where it 
helpfully removes extra line breaks. This would appear to be what's 
happening here.


When it does this it usually displays a notice somewhere to say it's 
done this and offers a way to undo it.


-Stut

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



Re: [PHP] \n problems when creating an email

2008-02-11 Thread Daniel Brown
On Feb 11, 2008 7:10 AM, Angelo Zanetti [EMAIL PROTECTED] wrote:
 Hi guys,

 I am making email text based on some fields the user fills in and then email
 the admin the details.

 I am having a problem where sometimes the \n (new line) works and sometimes
 it just does nothing. Im not sure the cause but I cant seem to figure it
 out.

Try using HEREDOC syntax instead:

$message =EOM

How far would they be prepared to travel to
event venue?
$travel
Do you have a specific location
of preference?
$locationPref
City or country preference:$cityPref

EOM;

It may not prevent the client from reformatting the message on
delivery, as Stut, Nathan, and Wolf already correctly mentioned, but
placing it in a HEREDOC will improve readability, send an exact
structure without need for interpretation (of
newlines-vs-carriage-return-newlines and number of spaces per tab),
and allow you to freely use quotes without having to remember to
escape them (or escape to insert a variable).

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



RE: [PHP] \n problems when creating an email

2008-02-11 Thread Angelo Zanetti

Looks like you're using Outlook. It has an annoying feature where it 
helpfully removes extra line breaks. This would appear to be what's 
happening here.

When it does this it usually displays a notice somewhere to say it's 
done this and offers a way to undo it.



Thanks, dam I been wasting my time trying to figure out the solution...

However I see that with the tabbed (\t) formatting its very inconsistent in
many email and web clients... Do you have a solution to ensure that the
output is consistent always?

Please send some links or any advice, TIA

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-14 Thread tedd

At 3:50 PM +0100 1/13/08, Jochem Maas wrote:

to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.

- 8 info.php 
?php

phpinfo();
- 8 info.php 


It may be a religious argument, but I always close my scripts and I 
know where the white space is.


Also, most of my code is used by other languages (i.e., html, js) so 
a closing bracket is always required -- unless it's the last function 
in a file, but I haven't checked to see if that works in all cases. 
So, I just always close it correctly.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Jochem Maas

Terry Calie schreef:

...



To illustrate my php goes like this:

index.php
=
?php
code
code
require index2.php
code
?

index2.php

?php
code
code
code
?
whitespace character


...

to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.

- 8 info.php 
?php

phpinfo();
- 8 info.php 

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Europus

Jochem Maas wrote:


?
whitespace character

...
to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.
- 8 info.php 
?php

phpinfo();
- 8 info.php 


I didn't know that. Does the underlying engine in PHP provide the
otherwise missing tag? Does the described problem only happen with
FF on Mac or does it affect other browsers on other OSes?

Ulex

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Jochem Maas

Europus schreef:

Jochem Maas wrote:


?
whitespace character

...
to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.
- 8 info.php 
?php

phpinfo();
- 8 info.php 


I didn't know that. Does the underlying engine in PHP provide the
otherwise missing tag? 


the tag is not missing as such - the tag denotes the end of string that
php parses - it's quite logical to assume that the end of a file means the same
thing (especially when you consider that any file you include/require
must specify '?php' to 'awaken' the php parser)


Does the described problem only happen with
FF on Mac or does it affect other browsers on other OSes?


I have never seen this problem effect just one browser on on platform -
afaic it's a general problem that effects all browsers - you can't send
out HTTP headers after HTTP content ... now it maybe that some browsers
these days see fit to ignore white space before the headers (or maybe
just ignore a \n) but I doubt it ... honestly I can't see how php
would even send the headers after the \n had been output ... either
you error logging level is too low, your not reading the error log or you
have error suppression on the header() function (.e.g @header()). all
of these would give you the incorrect notion that the header function
was working, all of these are bad practice.

you also mentioned you changed the code when trying to test it on another
machine - don't do that, test one thing at a time.

anyway problem solved, preventative knowledge aquired, onto the next hurdle :-)



Ulex



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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Europus

 Jochem Maas wrote:


you also mentioned you changed the code when trying to test it on another
machine - don't do that, test one thing at a time.


I'm not the original poster, that wasn't me.

anyway problem solved, preventative knowledge aquired, onto the next 
hurdle :-)


I'm having some trouble with a for() loop and echoing array results
to screen to see if I'm getting the data I'm after, I may post about
it later.

Ulex

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Jochem Maas

Europus schreef:

 Jochem Maas wrote:


you also mentioned you changed the code when trying to test it on another
machine - don't do that, test one thing at a time.


I'm not the original poster, that wasn't me.

anyway problem solved, preventative knowledge aquired, onto the next 
hurdle :-)


I'm having some trouble with a for() loop and echoing array results
to screen to see if I'm getting the data I'm after, I may post about
it later.


use var_dump() rather than echo.



Ulex



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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-12 Thread Terry Calie
Hey... thanks for the replies.  I installed the headers feature that 
Richard suggested and found that no headers were output. 

I started to transfer my php to another site to see if the problem 
replicated and I wasn't able to recreate the problem.  

It turns out that I require a file before the session_start that had 
one stupid character of whitespace at the end of it.  When I transferred 
the php to recreate the problem, I replaced the require call with the 
actual code - eliminating the whitespace at the end of the file, so the 
problem didn't replicate.  It took me a long time to figure out that was 
the problem.  What a killer!


To illustrate my php goes like this:

index.php
=
?php
code
code
require index2.php
code
?

index2.php

?php
code
code
code
?
whitespace character

The whitespace character is actually just an extra newline \n at the 
end of the file.  So that gets output to the browser before the headers 
and apparently doesn't lock up any browsers except FireFox on a Mac.


Thanks for the help.  Just your courtesy in responses got me thinking in 
a new direction.

Terry




Richard Lynch wrote:

Install Live HTTP Headers and see what headers are being sent.

Then search for those headers and FireFox Mac issues online.

On Fri, January 11, 2008 10:34 am, Terry Calie wrote:
  

Sorry if this is the wrong place to ask this question... if so please
help me figure out where to ask it.  I've asked on FireFox forums and
was told it was a PHP problem and to ask the developers of PHP.

I have a PHP website that freezes in Firefox on a Mac.  Every other
browser/operating system combination I have tested is fine.  I've
narrowed down the problem to having to do with session_start, which
is
the session tracking mechanism for php.

When I comment out session_start, the site works (but of course my
site
now becomes state-less).  Again, the problem is ONLY on FireFox on a
Mac.  It works fine on FireFox on a PC.

Any ideas as to what could be causing the problem with FireFox on Mac
and not on PC?  (Safari on Mac works fine)

Thanks,
Terry

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






  


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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-12 Thread Anup Shukla

Terry Calie wrote:
Hey... thanks for the replies.  I installed the headers feature that 
Richard suggested and found that no headers were output.
I started to transfer my php to another site to see if the problem 
replicated and I wasn't able to recreate the problem. 
It turns out that I require a file before the session_start that had 
one stupid character of whitespace at the end of it.  When I transferred 
the php to recreate the problem, I replaced the require call with the 
actual code - eliminating the whitespace at the end of the file, so the 
problem didn't replicate.  It took me a long time to figure out that was 
the problem.  What a killer!




You may use ob_clean() just before the header()
to get rid of the extra whitespaces.

--
Regards,
Anup Shukla

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-11 Thread Daniel Brown
On Jan 11, 2008 11:53 AM, Jason Pruim [EMAIL PROTECTED] wrote:
 With a problem like that, code and a web page are very helpful to
 track it down. I'm willing to take a look at what I can with my Mac 
 firefox, and see what I can sort out :)

 I just need more info..



 On Jan 11, 2008, at 11:34 AM, Terry Calie wrote:

  Sorry if this is the wrong place to ask this question... if so
  please help me figure out where to ask it.  I've asked on FireFox
  forums and was told it was a PHP problem and to ask the developers
  of PHP.
 
  I have a PHP website that freezes in Firefox on a Mac.  Every other
  browser/operating system combination I have tested is fine.  I've
  narrowed down the problem to having to do with session_start,
  which is the session tracking mechanism for php.
 
  When I comment out session_start, the site works (but of course my
  site now becomes state-less).  Again, the problem is ONLY on FireFox
  on a Mac.  It works fine on FireFox on a PC.
 
  Any ideas as to what could be causing the problem with FireFox on
  Mac and not on PC?  (Safari on Mac works fine)

Terry,

I had seen your posts before (I'm a Mozilla developer as well),
but I didn't see mention of a version.  What Mac FF version are you
using, and what plugins do you have installed?  Try disabling all
plugins, restarting Firefox, and seeing if it will work for you then.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-11 Thread Jason Pruim
With a problem like that, code and a web page are very helpful to  
track it down. I'm willing to take a look at what I can with my Mac   
firefox, and see what I can sort out :)


I just need more info..


On Jan 11, 2008, at 11:34 AM, Terry Calie wrote:

Sorry if this is the wrong place to ask this question... if so  
please help me figure out where to ask it.  I've asked on FireFox  
forums and was told it was a PHP problem and to ask the developers  
of PHP.


I have a PHP website that freezes in Firefox on a Mac.  Every other  
browser/operating system combination I have tested is fine.  I've  
narrowed down the problem to having to do with session_start,  
which is the session tracking mechanism for php.


When I comment out session_start, the site works (but of course my  
site now becomes state-less).  Again, the problem is ONLY on FireFox  
on a Mac.  It works fine on FireFox on a PC.


Any ideas as to what could be causing the problem with FireFox on  
Mac and not on PC?  (Safari on Mac works fine)


Thanks,
Terry

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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] session_start problems with FireFox on Mac

2008-01-11 Thread Richard Lynch
Install Live HTTP Headers and see what headers are being sent.

Then search for those headers and FireFox Mac issues online.

On Fri, January 11, 2008 10:34 am, Terry Calie wrote:
 Sorry if this is the wrong place to ask this question... if so please
 help me figure out where to ask it.  I've asked on FireFox forums and
 was told it was a PHP problem and to ask the developers of PHP.

 I have a PHP website that freezes in Firefox on a Mac.  Every other
 browser/operating system combination I have tested is fine.  I've
 narrowed down the problem to having to do with session_start, which
 is
 the session tracking mechanism for php.

 When I comment out session_start, the site works (but of course my
 site
 now becomes state-less).  Again, the problem is ONLY on FireFox on a
 Mac.  It works fine on FireFox on a PC.

 Any ideas as to what could be causing the problem with FireFox on Mac
 and not on PC?  (Safari on Mac works fine)

 Thanks,
 Terry

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Comparison Problems with 5.2.5

2007-12-30 Thread Silvio Porcellana

Magnus Anderson wrote:


...snip...

This will not work (I expect this to work since _USER['level'] is 5)
if($_USER['level'] = 5)



Try
if($_USER['level'] = 5)

maybe it helps ('=' is used when assigning values in an hash, maybe you 
are triggering something strange...)


--
Antinori and Partners - http://www.antinoriandpartners.com
Soluzioni web - da professionisti

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



Re: [PHP] Comparison Problems with 5.2.5

2007-12-30 Thread Casey
On Dec 30, 2007 8:04 AM, Silvio Porcellana [EMAIL PROTECTED] wrote:
 Magnus Anderson wrote:
 
  ...snip...
 
  This will not work (I expect this to work since _USER['level'] is 5)
  if($_USER['level'] = 5)
 

 Try
 if($_USER['level'] = 5)

 maybe it helps ('=' is used when assigning values in an hash, maybe you
 are triggering something strange...)

 --
 Antinori and Partners - http://www.antinoriandpartners.com
 Soluzioni web - da professionisti


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



I think it needs to be = (greater than or equal to) or = (less than
or equal to).
-Casey

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



Re: [PHP] Comparison Problems with 5.2.5

2007-12-30 Thread Richard Lynch
You want = and not =

The = operator doesn't even  make any sense in that context, as far
as I know...

On Sun, December 30, 2007 8:34 am, Magnus Anderson wrote:

 Hi,

 I have runned into a slight annoying problem with my code, that I have
 never
 had before.
 Either I have something wrong in my code or PHP 5.2.5 that I user is
 acting
 weird in windows. I have recently installed PHP on my windows machine
 for
 local developement instead of a remote server.

 What I try to do is to make an if statement betwean two string
 numbers.

 $_USER['level'] = The level the user has

 The $_USER['level'] string is taken from the Database and is 5.

 This will not work (I expect this to work since _USER['level'] is 5)
 if($_USER['level'] = 5)

 This will work (And I expect it to work to)
 if($_USER['level'] = 6)

 This will work (Not supposed to work since _USER['level'] is 5)
 if($_USER['level']  5)

 --
 View this message in context:
 http://www.nabble.com/Comparison-Problems-with-5.2.5-tp14547671p14547671.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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: Problems with matrix

2007-08-29 Thread Richard Lynch
Do you REALLY need all the values in one giant matrix at once?

You might be MUCH better off to read a single line, process it,
discard it, and move on to the next one.

Your webhost is probably wrong and you probably ARE running out of RAM
and/or running afoul of PHP's time_limit in php.ini

set_time_limit(60) inside the loop would fix the time limit thing.

Nothing you can do about the RAM thing, I don't think.

On Tue, August 28, 2007 10:58 pm, Felipe Alcacibar wrote:
 Andres Rojas wrote:
 Hi all,

 I'm new in PHP programming and I have a problem with this script. I
 need
 to read a large file around 2Mb and several lines (28000). All start
 Ok,
 but suddenly the script stop without message error.

 ?php
  $fichero=62007lg.txt;
 $buffer = file($fichero);
 $lineas = count($buffer);

foreach($buffer as $linea){

 list($day, $month, $year, $hour, $min, $temp, $hum, $dew, $baro,
 $wind, $gust, $wdir, $rlastm, $rdai, $rmon, $ryear,
 $heat)=sscanf($linea,%d %d %d %d %d %f %d %f %f %d %d %d %f %f %f
 %f %f \n);

  $mday[]=$day;
  $mmonth[]=$month;
  $myear[]=$year;
  $mhour[]=$hour;
  $mmin[]=$min;
  $mtemp[]=$temp;
  $mhum[]=$hum;
  $mdew[]=$dew;
  $mbaro[]=$baro;
  $mwind[]=$wind;
  $mgust[]=$gust;
  $mwdir[]=$wdir;
  $mrlastm[]=$rlastm;
  $mdai[]=$rdai;
  $mrmon[]=$rmon;
  $mryear[]=$ryear;
  $mheat[]=$heat;
  echo$day $month $year $hour $min $temp $hum $dew $baro $wind $gust
 $wdir $rlastm $rdai $rmon $ryear $heat br;
  }

  ?

 If only I print the variable $buffer all it's ok, but when I try to
 fill
 all the matrix the script doesn't work. If I reduce the number of
 matrix
 only a 3 o 4 it's Ok, but If I increase number of this matrix the
 script
 crash again.

 Perhaps it's a problem of memory of server, but my  service provider
 say
 me that this is not the problem.


 Thank you very much

 Andres:

  The info is too poor to see what is wrong, maybe you need to
 review
 a error_reporting() php function, o error_reporting php.ini variable i
 send you some code:

 ?php
 error_reporting(E_ALL);

  $fichero=62007lg.txt;
  $buffer = file($fichero);
  $lineas = count($buffer);

 foreach($buffer as $linea){

   $data = preg_split(/\s+/, trim($linea));
   // trim removes all white spaces at the end and the beginning of
 the string.
   $k = 0;
   foreach(array(
   'mday', 'mmonth',
   'myear', 'mhour',
   'mtemp',  'mhum',
   'mdew', 'mbaro',
   'mwind', 'mgust',
   'mwdir',  'mrlastm',
   'mrdai', 'mrmon',
   'mryear', 'mheat' ) as $var )
   {
   if(!isset($$var)) $$var = array();
  array_push($$var, $data[$k]);
  echo $var. = .$data[$k];
   $k++;
   }

 }
 ?

 cheers!!

 Felipe Alcacibar

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




-- 
Please vote for this great band:
http://acl.mp3.com/feature/soundandjury/?band=COMPANY-OF-THIEVES

Requires email confirmation.
One vote per day per email limit.
Obvious ballot-stuffing will be revoked.

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



Re: [PHP] php problems

2007-08-08 Thread Chris


a.) PHP Fatal error:  main() [a 
href='function.require'function.require/a]: Failed opening required 
'DB.php' (include_path='C:\php\pear') in C:\sambar64\docs\BondMovies.php on line 11


require_once('DB.php');


snip

Isn't the pear db class DB/DB.php ?


 b.)PHP Parse error:  syntax error, unexpected ';' in
 C:\sambar64\docs\ButtonMaker.php on line 17

snip


$dx = abs($tsize[2]-$tsize[0]);
$dy = abs($tsize[5]-$tsize[3]);
$x = ( imagesX($im) - $dx ) / 2;
$y = ( imagesy($im) - $dy / 2 + $dy;


You're missing a close bracket here somewhere.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] fsockopen problems

2007-06-22 Thread Tijnema

On 6/22/07, Ray [EMAIL PROTECTED] wrote:

hello,
I'm having some problems with fsockopen and was hopping for some help.
I try to connect to a host via fsockopen and I get getaddrinfo failed
errors, but if I try fsockopen with google, everything works.

sample test code
  $fp=fsockopen('apps.subname.domain.com/xml_2.4/xml.php',80,$errno,
$errstr);
   var_dump($errno);
   var_dump($errstr);
   $fp=fsockopen(000.00.00.000/xml_2.4/xml.php,80,$errno, $errstr);
   var_dump($errno);
   var_dump($errstr);
   $fp=fsockopen('www.google.ca',80,$errno, $errstr);
   var_dump($errno);
   var_dump($errstr);

(sorry for sanitizing, not my choice.)
I can ping the host from the server, and going to this site in a browser gives
the expected output.

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: hostname nor servname provided, or not known
in /usr/local/www/apache22/data/index.php on line 119

Warning: fsockopen() [function.fsockopen]: unable to connect to
apps.subname.domain.com/xml_2.4/xml.php:80 (Unknown error)
in /usr/local/www/apache22/data/index.php on line 119
int(0) string(0) 

[note no error for google. should be here]

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: hostname nor servname provided, or not known
in /usr/local/www/apache22/data/index.php on line 122

Warning: fsockopen() [function.fsockopen]: unable to connect to
000.00.00.000/xml_2.4/xml.php:80 (Unknown error)
in /usr/local/www/apache22/data/index.php on line 122
int(0) string(0)  int(0) string(0) 



With fsockopen you connect to a host, not to the host with full path...
This would work fine:
$fp=fsockopen('apps.subname.domain.com',80,$errno,
$errstr);
  var_dump($errno);
  var_dump($errstr);
Now you probably want to get that file, so you should do a fwrite:
fwrite($fp,GET /xml_2.4/xml.php HTTP/1.1\r\nHost:
apps.subname.domain.com\r\n\r\n);
*note: All above should be on one single line
Then, after you made a request, you can get the data with fread:
$data = fread($fp,102400); // 100KB of data max
This returns the page, including the headers!
If you only want data, you're better off using file_get_contents
function, like this:
$data = file_get_contents('apps.subname.domain.com/xml_2.4/xml.php);

Hope this helps ;)

Tijnema


--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

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



Re: [PHP] fsockopen problems

2007-06-22 Thread Ray
On Friday 22 June 2007 10:59 am, Tijnema wrote:
 On 6/22/07, Ray [EMAIL PROTECTED] wrote:
  hello,
  I'm having some problems with fsockopen and was hopping for some help.
  I try to connect to a host via fsockopen and I get getaddrinfo failed
  errors, but if I try fsockopen with google, everything works.
 
  sample test code
$fp=fsockopen('apps.subname.domain.com/xml_2.4/xml.php',80,$errno,
  $errstr);
 var_dump($errno);
 var_dump($errstr);
 $fp=fsockopen(000.00.00.000/xml_2.4/xml.php,80,$errno, $errstr);
 var_dump($errno);
 var_dump($errstr);
 $fp=fsockopen('www.google.ca',80,$errno, $errstr);
 var_dump($errno);
 var_dump($errstr);
 
  (sorry for sanitizing, not my choice.)
  I can ping the host from the server, and going to this site in a browser
  gives the expected output.
 
  Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
  getaddrinfo failed: hostname nor servname provided, or not known
  in /usr/local/www/apache22/data/index.php on line 119
 
  Warning: fsockopen() [function.fsockopen]: unable to connect to
  apps.subname.domain.com/xml_2.4/xml.php:80 (Unknown error)
  in /usr/local/www/apache22/data/index.php on line 119
  int(0) string(0) 
 
  [note no error for google. should be here]
 
  Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
  getaddrinfo failed: hostname nor servname provided, or not known
  in /usr/local/www/apache22/data/index.php on line 122
 
  Warning: fsockopen() [function.fsockopen]: unable to connect to
  000.00.00.000/xml_2.4/xml.php:80 (Unknown error)
  in /usr/local/www/apache22/data/index.php on line 122
  int(0) string(0)  int(0) string(0) 

 With fsockopen you connect to a host, not to the host with full path...
 This would work fine:
 $fp=fsockopen('apps.subname.domain.com',80,$errno,
 $errstr);
var_dump($errno);
var_dump($errstr);
 Now you probably want to get that file, so you should do a fwrite:
 fwrite($fp,GET /xml_2.4/xml.php HTTP/1.1\r\nHost:
 apps.subname.domain.com\r\n\r\n);
 *note: All above should be on one single line
 Then, after you made a request, you can get the data with fread:
 $data = fread($fp,102400); // 100KB of data max
 This returns the page, including the headers!
 If you only want data, you're better off using file_get_contents
 function, like this:
 $data = file_get_contents('apps.subname.domain.com/xml_2.4/xml.php);

 Hope this helps ;)

 Tijnema

Thanks, that does help. Thats exactly what I was looking for.
Ray

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



Re: [PHP] mbstring problems

2007-06-15 Thread Martin Marques

Crayon Shin Chan wrote:

On Friday 15 June 2007 04:09, Martin Marques wrote:

Using PHP 5.2.0 and I get this error:

Fatal error: Call to undefined function mb_list_encodings_alias_names()
in /home/martin/prueba.php on line 3

But mb_list_encodings() works like a charm. What's wrong?


RTFM



Did it, but gives no real answer about it. I even found the BUG report 
about the issue.


--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-

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



  1   2   3   4   5   6   7   >