RE: [PHP] More math fun

2008-08-13 Thread Alex Chamberlain
1.7763568394E-15 is 0. The computer just had a rounding error somewhere. We
had this discussion a few weeks ago, the solution being to decide to what
accuracy you want the answer. Upto 14 decimal places will give you 0 here!!

Alex

> -Original Message-
> From: Robert Cummings [mailto:[EMAIL PROTECTED]
> Sent: 13 August 2008 05:39
> To: Micah Gersten
> Cc: Jim Lucas; Jay Blanchard; php-general@lists.php.net
> Subject: Re: [PHP] More math fun
> 
> On Tue, 2008-08-12 at 23:23 -0500, Micah Gersten wrote:
> > Robert, when you do yours, it's performing the same function on two
> > different variable types and has to do a conversion before the
> function
> > works.  He was doing a numeric function on a string which might be
> > giving the funky results.
> 
> That's what Jim tried and got 0 and double... I confirmed Jim's results
> (I didn't originally test Jay's problem) and then tried the alternative
> that I might have thought this morning. Either way, it seems to come up
> as 0. Maybe Jay is running a buggy version of PHP.
> 
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.138 / Virus Database: 270.6.1/1608 - Release Date:
> 12/08/2008 16:59

No virus found in this outgoing message. Scanned by AVG Free 8.0
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.6.1/1608 - Release Date: 12/08/2008
16:59


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



RE: [PHP] More math fun

2008-08-13 Thread Robert Cummings
On Wed, 2008-08-13 at 08:14 +0100, Alex Chamberlain wrote:
> 1.7763568394E-15 is 0. The computer just had a rounding error somewhere. We
> had this discussion a few weeks ago, the solution being to decide to what
> accuracy you want the answer. Upto 14 decimal places will give you 0 here!!

I thought we had a different discussion a couple of weeks ago about
floating point storage precision. How come only Jay is getting *this*
rounding error?

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



RE: [PHP] If Column Exists

2008-08-13 Thread Per Jessen
Jay Blanchard wrote:

> [snip]
> I am working on data migration for one mysql db to another using PHP.
> How do
> I check if a particular table has a particular column. If not alter...
> [/snip]
> 
> Use DESCRIBE TABLE;
> 

Then you'd have to parse the output - how about

SELECT  FROM  LIMIT 1  ?

The query will fail if the column doesn't exist.


/Per Jessen, Zürich


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



[PHP] Anyone using Lighttpd + webdav and a PHP handler?

2008-08-13 Thread mike
i.e. using PUT and using a .php script as the handler for it?

I can successfully PUT a file to /path/to/file-that-doesnt-exist.txt

However, when I try to do a PUT to an existing .php script it gives me
access denied, most likely due to the fact that a file exists. I don't
want it to actually try overwriting the file, and is-readonly =
"enable" or "disable" doesn't seem to change this behavior...

Just wondering if anyone out there has done this.

I did it no problem in nginx using a .php handler and set DAV to
readonly - no issues whatsoever...

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



Re: [PHP] If Column Exists

2008-08-13 Thread Robin Vickery
2008/8/12 VamVan <[EMAIL PROTECTED]>:
> Hello,
>
> I am working on data migration for one mysql db to another using PHP. How do
> I check if a particular table has a particular column. If not alter...
>
> Thanks
>

Use the information_schema:

SELECT COUNT(*) AS column_exists FROM information_schema.COLUMNS WHERE
TABLE_SCHEMA='db_name' AND TABLE_NAME='table_name' AND
COLUMN_NAME='column_name';

-robin

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



[PHP] Re: A dumb question regarding sending email

2008-08-13 Thread tedd

Hi gang:

Problem solved.

I was tired last night and used "http:www.example.com" and wondered 
why it wouldn't work. Duh!


I knew it was a dumb question that should have waited until I had a 
good night's sleep.


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



[PHP] SOAP - return a list of items

2008-08-13 Thread Dan Joseph
Hi,

I am using the PHP5 SOAP Functions...

I am trying to find some information on how to properly build a function
into my web service to return a list of quotes.  Each list will have a
QuoteID, Origin, Destination, Name.  Example:

1011, 48167, 90222, John Smith
1012, 54888, 19893, Joe Johnson
etc...

>From everything I read, I just need to build an array with this information,
and return it to the SOAP client trying to get the information.  I think the
problem lies in my WSDL, I am certain I need to setup a complexType that
handles the arrayType.  Unfortunately, I cannot find any resources on how to
setup the WSDL.

Can someone point in the direction to get going on this?  Anyone have an
example WSDL that handles this type of thing that I could look at?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."


RE: [PHP] More math fun

2008-08-13 Thread Jay Blanchard
[snip]
> 1.7763568394E-15 is 0. The computer just had a rounding error
somewhere. We
> had this discussion a few weeks ago, the solution being to decide to
what
> accuracy you want the answer. Upto 14 decimal places will give you 0
here!!

I thought we had a different discussion a couple of weeks ago about
floating point storage precision. How come only Jay is getting *this*
rounding error?
[/snip]

Perhaps it is the PHP version? I have tried this on three separate PHP
installations (all the same configs) and got the same results. I will
look to see if there is an upgraded version.

When applying round to the numbers everything works out as expected, but
makes me uncomfortable.

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



[PHP] phpguru.org back up

2008-08-13 Thread Richard Heyes
Hi,

You'll be pleased to know (I'm sure) that phpguru.org is back up and
working (for the most part I would imagine).

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] Re: A dumb question regarding sending email

2008-08-13 Thread Richard Heyes
> NSW Australia

North, South, West? Can't you make up your mind? :-)

-- 
Richard Heyes

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread David Giragosian
On 8/13/08, Richard Heyes <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> You'll be pleased to know (I'm sure) that phpguru.org is back up and
> working (for the most part I would imagine).


Congratulations, Richard.

Server crashes, data loss, and downtime are concerns for all of us.

--David.


Re: [PHP] Re: A dumb question regarding sending email

2008-08-13 Thread Ross McKay
On Wed, 13 Aug 2008 15:32:12 +0100, Richard Heyes wrote:

>> NSW Australia
>
>North, South, West? Can't you make up your mind? :-)

:) we move around a bit... though not so much for a while now!

Good to see you backup. I mean, back up!

(NSW is the state of New South Wales, on the East Coast of Australia, or
IOW somewhat to the left of Kalifornia and down a bit)
-- 
Ross McKay, Toronto, NSW Australia
"Under the big bright yellow sun" - Fat Boy Slim

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



Re: [PHP] More math fun

2008-08-13 Thread Jim Lucas

Jay Blanchard wrote:

[snip]

1.7763568394E-15 is 0. The computer just had a rounding error

somewhere. We

had this discussion a few weeks ago, the solution being to decide to

what

accuracy you want the answer. Upto 14 decimal places will give you 0

here!!

I thought we had a different discussion a couple of weeks ago about
floating point storage precision. How come only Jay is getting *this*
rounding error?
[/snip]

Perhaps it is the PHP version? I have tried this on three separate PHP
installations (all the same configs) and got the same results. I will
look to see if there is an upgraded version.

When applying round to the numbers everything works out as expected, but
makes me uncomfortable.



What is your precision in your php.ini file set to?  Default is 14.  If it is 
set to 16 or greater, then it would display the reseults you are seeing.  Mine 
is set to 14, so it would automatically round it to 0.  I think.


I will test, brb..

hmmm weird, if I set my precision to 20 and restart, I still get 0 for the 
value.  Odd, I would have thought it would have then shown me the expected value.




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



[PHP] Re: SOAP - return a list of items

2008-08-13 Thread Dan Joseph
Maybe more info will help:

Here is what I have so far for the WSDL...




































This validates fine in soapUI, and seems to work fine when the client
connects to it.

The piece from PHP:

$count = 0;

while ( $data = $this->dbconn->fetchrow( $res ) )
{
foreach ( $data as $key => $value )
{
$quotes[$count][$key] = $value;
}

$count++;
}

return $quotes;

This is the soap response:

http://schemas.xmlsoap.org/soap/encoding/"; xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="urn:ursquoteservice"
xmlns:ns2="urn:ursquote" xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/";>
   
  
 
  
   


It seems like I am just missing something somewhere.

Anyone able to help?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."


Re: [PHP] phpguru.org back up

2008-08-13 Thread Wolf
 Richard Heyes <[EMAIL PROTECTED]> wrote: 
> Hi,
> 
> You'll be pleased to know (I'm sure) that phpguru.org is back up and
> working (for the most part I would imagine).

Glad to hear it!

So, which backup solution are you using?  Or should I say which 12 backup 
solutions?  ;)

Wolf

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



[PHP] Re: A dumb question regarding sending email

2008-08-13 Thread Jonesy
On Thu, 14 Aug 2008 00:47:39 +1000, Ross McKay wrote:
> On Wed, 13 Aug 2008 15:32:12 +0100, Richard Heyes wrote:
>
>>> NSW Australia
>>
>>North, South, West? Can't you make up your mind? :-)
>
>:) we move around a bit... though not so much for a while now!
>
> Good to see you backup. I mean, back up!
>
> (NSW is the state of New South Wales, on the East Coast of Australia, or
> IOW somewhat to the left of Kalifornia and down a bit)

I'd've thought with Aussie, Southern Cross-oriented globes, it would be 
to the _right_ of Kalifornia and _up_ a bit.

Jonesy


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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Richard Heyes
> Congratulations, Richard.
>
> Server crashes, data loss, and downtime are concerns for all of us.

Thanks. Fortunately I managed to get away with minimal data loss, and,
unsurprisingly, I've now got backups. :-)

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Richard Heyes
> Really? It doesn't work for me.
>
> http://www.phpguru.org/
>
>
> I'm getting the following :
>
> Unable to connect
> Firefox can't establish a connection to the server at www.phpguru.org.
> *   The site could be temporarily unavailable or too busy. Try again in
> a few
>   moments.
> *   If you are unable to load any pages, check your computer's network
>   connection.
> *   If your computer or network is protected by a firewall or proxy,
> make sure
>   that Firefox is permitted to access the Web.
>
>
> Looks like it resolves to an IP (67.205.76.91), which I can ping, but the
> server isn't returning a HTTP response.
>
> Although... I might be resolving to an old IP, checking on another
> connection resolves to 217.160.188.12, which seems to work.
> Guess the DNS change is still propagating.

IDD. The 217. is the correct one. If you really wanted to you could
mung your hosts file. I'm guessing you don't though...

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Richard Heyes
> So, which backup solution are you using?  Or should I say which 12 backup 
> solutions?  ;)

Lol. Not that sophisticated actually, trusty old tar and gzip, along
with regular downloads to my desktop so that they're in two locations.

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] Re: A dumb question regarding sending email

2008-08-13 Thread Richard Heyes
> I'd've thought with Aussie, Southern Cross-oriented globes

Charlaton. :-)

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Ashley M. Kirchner

Richard Heyes wrote:

Lol. Not that sophisticated actually, trusty old tar and gzip, along
with regular downloads to my desktop so that they're in two locations
   If I may suggest ... if you have a second system that doesn't have a 
big load, you can simply rsync the data from one to the other every 24 
hours or however many times you want.  This way, when your primary 
system bites the dust, you can easily switch to the backup one and keep 
running while you work on the primary one.


--
H | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Imaging   . 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 



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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Wolf

 Richard Heyes <[EMAIL PROTECTED]> wrote: 
> > So, which backup solution are you using?  Or should I say which 12 backup 
> > solutions?  ;)
> 
> Lol. Not that sophisticated actually, trusty old tar and gzip, along
> with regular downloads to my desktop so that they're in two locations.

Before I got smart in locking down my forms, someone tried to hack my site.  
They got some of the files but not all.  Luckily the ones they got were ones 
that I had backups of.  Only it took me a couple of days to FIND them.  Now my 
DBs back themselves up hourly and my full site goes tar as well.  And the forms 
are fully secured out.  :)

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



Re: [PHP] Re: A dumb question regarding sending email

2008-08-13 Thread Richard Heyes
> Good to see you backup. I mean, back up!

I think both would apply now... :-)

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Richard Heyes
> And the forms are fully secured out.  :)
>

You think... ;-)

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Richard Heyes
>   If I may suggest ... if you have a second system that doesn't have a big
> load, you can simply rsync the data from one to the other every 24 hours or
> however many times you want.  This way, when your primary system bites the
> dust, you can easily switch to the backup one and keep running while you
> work on the primary one.

Good for something that generates money, but not for my personal stuff
which I'm not too fussed about.

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Stut

On 13 Aug 2008, at 17:26, Richard Heyes wrote:
 If I may suggest ... if you have a second system that doesn't have  
a big
load, you can simply rsync the data from one to the other every 24  
hours or
however many times you want.  This way, when your primary system  
bites the
dust, you can easily switch to the backup one and keep running  
while you

work on the primary one.


Good for something that generates money, but not for my personal stuff
which I'm not too fussed about.


I would recommend http://www.rsync.net/ for this. They're pretty cheap  
($1.60/GB/month), very reliable and their support is top-notch. If you  
need it you can pay a tiny bit extra ($2.80/GB/month) and get geo- 
redundant storage. They also have discounts if you need more than 25GB.


I am not affiliated with them in any way, but I've been using the  
service since it launched and have never had a problem.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: A dumb question regarding sending email

2008-08-13 Thread tedd

At 12:47 AM +1000 8/14/08, Ross McKay wrote:

On Wed, 13 Aug 2008 15:32:12 +0100, Richard Heyes wrote:


 NSW Australia


North, South, West? Can't you make up your mind? :-)


:) we move around a bit... though not so much for a while now!

Good to see you backup. I mean, back up!

(NSW is the state of New South Wales, on the East Coast of Australia, or
IOW somewhat to the left of Kalifornia and down a bit)



So, you could say NSWE Australia.

Reminds me of a logo I designed for a NEWS publication.

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] phpguru.org back up

2008-08-13 Thread Richard Heyes
> but I've been using the service
> since it launched and have never had a problem.

Out of interest, when was that?

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread tedd

At 5:04 PM +0100 8/13/08, Richard Heyes wrote:

Thanks. Fortunately I managed to get away with minimal data loss, and,
unsurprisingly, I've now got backups. :-)

--
Richard Heyes



That's good to hear -- on both counts.

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] More math fun

2008-08-13 Thread Robert Cummings
On Wed, 2008-08-13 at 07:47 -0700, Jim Lucas wrote:
> Jay Blanchard wrote:
> > [snip]
> >> 1.7763568394E-15 is 0. The computer just had a rounding error
> > somewhere. We
> >> had this discussion a few weeks ago, the solution being to decide to
> > what
> >> accuracy you want the answer. Upto 14 decimal places will give you 0
> > here!!
> > 
> > I thought we had a different discussion a couple of weeks ago about
> > floating point storage precision. How come only Jay is getting *this*
> > rounding error?
> > [/snip]
> > 
> > Perhaps it is the PHP version? I have tried this on three separate PHP
> > installations (all the same configs) and got the same results. I will
> > look to see if there is an upgraded version.
> > 
> > When applying round to the numbers everything works out as expected, but
> > makes me uncomfortable.
> > 
> 
> What is your precision in your php.ini file set to?  Default is 14.  If it is 
> set to 16 or greater, then it would display the reseults you are seeing.  
> Mine 
> is set to 14, so it would automatically round it to 0.  I think.
> 
> I will test, brb..
> 
> hmmm weird, if I set my precision to 20 and restart, I still get 0 for the 
> value.  Odd, I would have thought it would have then shown me the expected 
> value.

I tried the highest precision setting that PHP appears to honour... 54.
I still get 0 :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] If Column Exists

2008-08-13 Thread VamVan
Interesting. Thanks guys!!

On Wed, Aug 13, 2008 at 1:32 AM, Robin Vickery <[EMAIL PROTECTED]> wrote:

> 2008/8/12 VamVan <[EMAIL PROTECTED]>:
> > Hello,
> >
> > I am working on data migration for one mysql db to another using PHP. How
> do
> > I check if a particular table has a particular column. If not alter...
> >
> > Thanks
> >
>
> Use the information_schema:
>
> SELECT COUNT(*) AS column_exists FROM information_schema.COLUMNS WHERE
> TABLE_SCHEMA='db_name' AND TABLE_NAME='table_name' AND
> COLUMN_NAME='column_name';
>
> -robin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Class diagram util

2008-08-13 Thread Christoph Boget
I'm curious, what utilities do you guys use, if any at all, to map
out/diagram your classes?  I'm looking for a decent (I don't really
need a ton of bells and whistles) freeware app but my searches thus
far have proven fruitless.

thnx,
Christoph

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



Re: [PHP] phpguru.org back up

2008-08-13 Thread Stut

On 13 Aug 2008, at 17:39, Richard Heyes wrote:

but I've been using the service
since it launched and have never had a problem.


Out of interest, when was that?


Now you're asking... I think it was around April 2006 but if I'm  
honest I can't remember. Prior to that I was using a hosting company  
called JohnCompanies.com and rsync.net was created by them. Based on  
the superior reliability and support for the hosting I immediately  
jumped on remote storage by the same guys.


-Stut

--
http://stut.net/

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



Re: [PHP] Class diagram util

2008-08-13 Thread Nathan Nobbe
On Wed, Aug 13, 2008 at 11:33 AM, Christoph Boget <[EMAIL PROTECTED]> wrote:

> I'm curious, what utilities do you guys use, if any at all, to map
> out/diagram your classes?  I'm looking for a decent (I don't really
> need a ton of bells and whistles) freeware app but my searches thus
> far have proven fruitless.


on linux, dia is a classic ;)  however you will also find kivio (a kde dia
wrapper) and umbrello available.

-nathan


[PHP] Re: regex

2008-08-13 Thread Philip Thompson

Figured it out. Just needed to stretch my brain a lil.

On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote:




$pattern = '/(.*).php\?action=([^&]+)+/';



 preg_match ($pattern, $subject, $matches);
 return $matches;
}

blegh ('somePage.php?action=doSomething&id=');
?>

Ok, the important parts that I need to obtain from this are:

somePage
doSomething

How can you modify the pattern above to grab the action  
appropriately? Sorry, my regex is a lil rusty!


Thanks in advance,
~Phil


Cheers,
~Philip

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



Re: [PHP] Re: regex

2008-08-13 Thread Micah Gersten
Take a look at this function, it'll make things  a little easier:
http://us3.php.net/manual/en/function.parse-str.php

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Philip Thompson wrote:
> Figured it out. Just needed to stretch my brain a lil.
>
> On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote:
>
>> > function blegh ($subject) {
>>  // I know this pattern doesn't exactly work
>>  $pattern = '/(.*).php\?action=([^&].*)/';
>
> $pattern = '/(.*).php\?action=([^&]+)+/';
>
>
>>  preg_match ($pattern, $subject, $matches);
>>  return $matches;
>> }
>>
>> blegh ('somePage.php?action=doSomething&id=');
>> ?>
>>
>> Ok, the important parts that I need to obtain from this are:
>>
>> somePage
>> doSomething
>>
>> How can you modify the pattern above to grab the action
>> appropriately? Sorry, my regex is a lil rusty!
>>
>> Thanks in advance,
>> ~Phil
>
> Cheers,
> ~Philip
>

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



[PHP] regex

2008-08-13 Thread Philip Thompson



Ok, the important parts that I need to obtain from this are:

somePage
doSomething

How can you modify the pattern above to grab the action appropriately?  
Sorry, my regex is a lil rusty!


Thanks in advance,
~Phil

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



[PHP] Re: regex

2008-08-13 Thread Shawn McKenzie

Philip Thompson wrote:

Figured it out. Just needed to stretch my brain a lil.

On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote:




$pattern = '/(.*).php\?action=([^&]+)+/';



 preg_match ($pattern, $subject, $matches);
 return $matches;
}

blegh ('somePage.php?action=doSomething&id=');
?>

Ok, the important parts that I need to obtain from this are:

somePage
doSomething

How can you modify the pattern above to grab the action appropriately? 
Sorry, my regex is a lil rusty!


Thanks in advance,
~Phil


Cheers,
~Philip


That regex might not always work for you, (&) comes to mind.  You 
might want to look at parse_str() which you can use after parse_url() if 
needed.


-Shawn

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



RE: [PHP] Re: regex

2008-08-13 Thread Boyd, Todd M.
> -Original Message-
> From: Shawn McKenzie [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 13, 2008 3:31 PM
> To: php-general@lists.php.net
> Subject: [PHP] Re: regex
> 
> Philip Thompson wrote:
> > Figured it out. Just needed to stretch my brain a lil.
> >
> > On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote:
> >
> >>  >> function blegh ($subject) {
> >>  // I know this pattern doesn't exactly work
> >>  $pattern = '/(.*).php\?action=([^&].*)/';
> >
> > $pattern = '/(.*).php\?action=([^&]+)+/';
> >
> >
> >>  preg_match ($pattern, $subject, $matches);
> >>  return $matches;
> >> }
> >>
> >> blegh ('somePage.php?action=doSomething&id=');
> >> ?>
> >>
> >> Ok, the important parts that I need to obtain from this are:
> >>
> >> somePage
> >> doSomething
> >>
> >> How can you modify the pattern above to grab the action
> appropriately?
> >> Sorry, my regex is a lil rusty!
> >>
> >> Thanks in advance,
> >> ~Phil
> >
> > Cheers,
> > ~Philip
> 
> That regex might not always work for you, (&) comes to mind.  You
> might want to look at parse_str() which you can use after parse_url()
> if
> needed.

I think /(.*)\.php\?action=([^&]+(?(&)[^&+]+))/ might be a step in the
right direction for RegExing the additional URL query string parameters.
I haven't tested it... but either way, I thought it was worth mentioning
that the ".php" part should be "\.php" (or "[.]php"), otherwise it will
match "any character followed by php."


Todd Boyd
Web Programmer



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



Re: [PHP] Re: regex

2008-08-13 Thread Philip Thompson

On Aug 13, 2008, at 3:31 PM, Shawn McKenzie wrote:


Philip Thompson wrote:

Figured it out. Just needed to stretch my brain a lil.
On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote:


$pattern = '/(.*).php\?action=([^&]+)+/';

preg_match ($pattern, $subject, $matches);
return $matches;
}

blegh ('somePage.php?action=doSomething&id=');
?>

Ok, the important parts that I need to obtain from this are:

somePage
doSomething

How can you modify the pattern above to grab the action  
appropriately? Sorry, my regex is a lil rusty!


Thanks in advance,
~Phil

Cheers,
~Philip


That regex might not always work for you, (&) comes to mind.   
You might want to look at parse_str() which you can use after  
parse_url() if needed.


-Shawn


That's a good thought. However, I am specifically sending a URL that  
has not yet been urlencoded, so I know that & won't be occurring.


Thanks,
~Philip


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



Re: [PHP] Re: regex

2008-08-13 Thread Philip Thompson

On Aug 13, 2008, at 4:06 PM, Boyd, Todd M. wrote:


-Original Message-
From: Shawn McKenzie [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 13, 2008 3:31 PM
To: php-general@lists.php.net
Subject: [PHP] Re: regex

Philip Thompson wrote:

Figured it out. Just needed to stretch my brain a lil.

On Aug 13, 2008, at 3:07 PM, Philip Thompson wrote:




$pattern = '/(.*).php\?action=([^&]+)+/';



preg_match ($pattern, $subject, $matches);
return $matches;
}

blegh ('somePage.php?action=doSomething&id=');
?>

Ok, the important parts that I need to obtain from this are:

somePage
doSomething

How can you modify the pattern above to grab the action

appropriately?

Sorry, my regex is a lil rusty!

Thanks in advance,
~Phil


Cheers,
~Philip


That regex might not always work for you, (&) comes to mind.  You
might want to look at parse_str() which you can use after parse_url()
if
needed.


I think /(.*)\.php\?action=([^&]+(?(&)[^&+]+))/ might be a step in the
right direction for RegExing the additional URL query string  
parameters.
I haven't tested it... but either way, I thought it was worth  
mentioning
that the ".php" part should be "\.php" (or "[.]php"), otherwise it  
will

match "any character followed by php."


Todd Boyd
Web Programmer


Good call! I so passed over that one. ;)

Thanks,
~Philip


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



[PHP] Re: A dumb question regarding sending email

2008-08-13 Thread Ross McKay
On Wed, 13 Aug 2008 15:46:47 + (UTC), Jonesy wrote:

>I'd've thought with Aussie, Southern Cross-oriented globes, it would be 
>to the _right_ of Kalifornia and _up_ a bit.

Yes, but I was translating from Strine to Wronglish for the North
Americans ;)
-- 
Ross McKay, Toronto, NSW Australia
"I come from a land down under,
 where beer does flow and men chunder" - Men At Work

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



[PHP] On one of my computers, php can't see an external javascript I included

2008-08-13 Thread googling1000

I have apache and php on Windows.
I have 3 computers. A php file is calling an external .js file.
Two of my computers have no problem calling a .js file, there's only one
machine that doesn't execute functions inside of the .js file.

My .php file has the following line in the beginning of the file:



My .js file consists of a number of functions written in javascript

I don't know why functions inside .js file doesn't get executed.

I tried copy/paste all the functions inside the .js file to my .php file and
it works.
I don't understand how my machine can't read an external .js file

I'm frustrated. Help will be appreciated!
-- 
View this message in context: 
http://www.nabble.com/On-one-of-my-computers%2C-php-can%27t-see-an-external-javascript-I-included-tp18975937p18975937.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



Re: [PHP] On one of my computers, php can't see an external javascript I included

2008-08-13 Thread Per Jessen
googling1000 wrote:

> 
> I have apache and php on Windows.
> I have 3 computers. A php file is calling an external .js file.
> Two of my computers have no problem calling a .js file, there's only
> one machine that doesn't execute functions inside of the .js file.
> 
> My .php file has the following line in the beginning of the file:
> 
> 
> My .js file consists of a number of functions written in javascript
> 
> I don't know why functions inside .js file doesn't get executed.
> 
> I tried copy/paste all the functions inside the .js file to my .php
> file and it works.

Check your apache log files to make sure your javascript source file is
being loaded. 


/Per Jessen, Zürich


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



Re: [PHP] On one of my computers, php can't see an external javascript I included

2008-08-13 Thread googling1000

Hi,

Thanks already for replying.
How do you check for that???
And, what do you have to do to force Apache to load it???



Per Jessen wrote:
> 
> googling1000 wrote:
> 
>> 
>> I have apache and php on Windows.
>> I have 3 computers. A php file is calling an external .js file.
>> Two of my computers have no problem calling a .js file, there's only
>> one machine that doesn't execute functions inside of the .js file.
>> 
>> My .php file has the following line in the beginning of the file:
>> 
>> 
>> My .js file consists of a number of functions written in javascript
>> 
>> I don't know why functions inside .js file doesn't get executed.
>> 
>> I tried copy/paste all the functions inside the .js file to my .php
>> file and it works.
> 
> Check your apache log files to make sure your javascript source file is
> being loaded. 
> 
> 
> /Per Jessen, Zürich
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/On-one-of-my-computers%2C-php-can%27t-see-an-external-javascript-I-included-tp18975937p18976152.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



Re: [PHP] On one of my computers, php can't see an external javascript I included

2008-08-13 Thread Per Jessen
googling1000 wrote:

> 
> Hi,
> 
> Thanks already for replying.
> How do you check for that???
> And, what do you have to do to force Apache to load it???
> 

You're on Windows, right?  Sorry, I don't know anything about Windows.


/Per Jessen, Zürich


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