Re: [PHP] sortind arrays

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-25 08:12:14 +0200:
> How can I sort an array like this so that it would be ASC ordered by the [1] 
> key in subarrays? I need to maintain only the subarray key - value pairs. 
> (Do I make sense?)
> 
> Array
> (
> [0] => Array
> (
> [0] => Logo
> [1] => NameC
> [2] => Home
> [3] => url
> )
> 
> [1] => Array
> (
> [0] => Logo
> [1] => NameA
> [2] => Home
> [3] => url
> )
> 
> [2] => Array
> (
> [0] => Logo
> [1] => NameG
> [2] => Home
> [3] => url
> )
> }

http://www.php.net/usort

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Parsing AJAX post data -- The Way

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-24 23:41:19 -0700:
> Just wondering what smart people do for parsing data sent by the  
> Javascript XMLHTTP object--e.g., http.send("post",url,true)...
> 
> In a normal form submit, the $_POST global nicely allocates form  
> elements as array elements automatically. But with the AJAX way, the  
> data get stuffed inside $HTTP_RAW_POST_DATA as a string, thereby  
> making extraction more tedious.

Are you looking for http://php.net/manual/en/ref.json.php ?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] sortind arrays

2007-01-24 Thread Paul Novitski

At 1/24/2007 10:12 PM, William Stokes wrote:

How can I sort an array like this so that it would be ASC ordered by the [1]
key in subarrays? I need to maintain only the subarray key - value pairs.
(Do I make sense?)

Array
(
[0] => Array
(
[0] => Logo
[1] => NameC
[2] => Home
[3] => url
)

[1] => Array
(
[0] => Logo
[1] => NameA
[2] => Home
[3] => url
)

[2] => Array
(
[0] => Logo
[1] => NameG
[2] => Home
[3] => url
)
}



Try multisort:
http://php.net/array_multisort

Regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] most powerful php editor

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-25 02:21:34 +0100:
> Curt Zirzow wrote:
> > On 1/20/07, Vinicius C Silva <[EMAIL PROTECTED]> wrote:
> >> hi everyone!
> >>
> >> i'd like to ask something maybe commonly asked here. what is the most
> >> powerful php editor?
> > 
> > 
> > So now we have a 4 day thread of discussing nothing but, this is what i
> > use
> 
> let see if we can make it a full week :-P

This thread has been going on 8 years ago when I first subscribed to
this list. 400 weeks has been enough! :]

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Validating a link in php

2007-01-24 Thread Frank Arensmeier

25 jan 2007 kl. 07.06 skrev [EMAIL PROTECTED]:


Richard Lynch wrote:

I dunno what you did wrong with fsockopen...


First of all, thanks for taking the time to respond.

I had tried fsockopen, but here's the problem.  The
following calls work as expected, returning a valid file
pointer for valid urls and FALSE for invalid urls:

$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
$fp = fsockopen("www.youtube.com", 80, $errno, $errstr, 30);
$fp = fsockopen("www.this_url_is_not_valid.com", 80, $errno,  
$errstr, 30);


The call below does not work and always returns FALSE.
If I enter the url in a web browser, it works fine, but
fsockopen does not like it.

$fp = fsockopen("www.youtube.com/v/JqO8ZevPJNk", 80, $errno,  
$errstr, 30);


I think it has something to do with the way YouTube
works.  Any clues?

Did you take a look at the error numbers / messages returned by  
fsockopen? What do they say? I can't see any problems with your code  
either. So, either the call gets stuck maybe due to some  
configuration on your machine (you can simply test it by changing you  
fsockopen call to e.g. www.php.net - or your lolcalhost), or - as you  
already mentioned - it is youTube that blocks your calls in some way  
(therefore, error message might give you a clue why).


Another thing that poped up in my mind - curl. Tried that?

//frank


Robert Porter

--
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] most powerful php editor

2007-01-24 Thread David Robley
tedd wrote:

> At 9:07 PM -0500 1/24/07, Robert Cummings wrote:

 
> Ahem to that!
> 
> You're on a roll brother -- keep going.
> 
> Can I get another Ahem?!
> 
> tedd

I'll see your 'Ahem' and raise you an 'Amen' :-)



Cheers
-- 
David Robley

Vultures only fly with carrion luggage.
Today is Setting Orange, the 25th day of Chaos in the YOLD 3173. 

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



[PHP] Parsing AJAX post data -- The Way

2007-01-24 Thread M5
Just wondering what smart people do for parsing data sent by the  
Javascript XMLHTTP object--e.g., http.send("post",url,true)...


In a normal form submit, the $_POST global nicely allocates form  
elements as array elements automatically. But with the AJAX way, the  
data get stuffed inside $HTTP_RAW_POST_DATA as a string, thereby  
making extraction more tedious.


Any ideas?

...Rene

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



[PHP] Parsing AJAX post data -- The Way

2007-01-24 Thread M5
Just wondering what smart people do for parsing data sent by the  
Javascript XMLHTTP object--e.g., http.send("post",url,true)...


In a normal form submit, the $_POST global nicely allocates form  
elements as array elements automatically. But with the AJAX way, the  
data get stuffed inside $HTTP_RAW_POST_DATA as a string, thereby  
making extraction more tedious.


Any ideas?

...Rene

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



[PHP] sortind arrays

2007-01-24 Thread William Stokes
Hello,

How can I sort an array like this so that it would be ASC ordered by the [1] 
key in subarrays? I need to maintain only the subarray key - value pairs. 
(Do I make sense?)

Array
(
[0] => Array
(
[0] => Logo
[1] => NameC
[2] => Home
[3] => url
)

[1] => Array
(
[0] => Logo
[1] => NameA
[2] => Home
[3] => url
)

[2] => Array
(
[0] => Logo
[1] => NameG
[2] => Home
[3] => url
)
}

Cheers!
-Will 

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



Re: [PHP] Validating a link in php

2007-01-24 Thread sleestak2
Richard Lynch wrote:
>I dunno what you did wrong with fsockopen...

First of all, thanks for taking the time to respond.

I had tried fsockopen, but here's the problem.  The
following calls work as expected, returning a valid file
pointer for valid urls and FALSE for invalid urls:

$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
$fp = fsockopen("www.youtube.com", 80, $errno, $errstr, 30);
$fp = fsockopen("www.this_url_is_not_valid.com", 80, $errno, $errstr, 30);

The call below does not work and always returns FALSE.
If I enter the url in a web browser, it works fine, but
fsockopen does not like it.

$fp = fsockopen("www.youtube.com/v/JqO8ZevPJNk", 80, $errno, $errstr, 30);

I think it has something to do with the way YouTube
works.  Any clues?

Robert Porter

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Larry Garfield
On Wednesday 24 January 2007 7:48 pm, John Meyer wrote:
> Jochem Maas wrote:
> > Curt Zirzow wrote:
> >> On 1/20/07, Vinicius C Silva <[EMAIL PROTECTED]> wrote:
> >>> hi everyone!
> >>>
> >>> i'd like to ask something maybe commonly asked here. what is the most
> >>> powerful php editor?
> >>
> >> So now we have a 4 day thread of discussing nothing but, this is what i
> >> use
> >
> > let see if we can make it a full week :-P
>
> If we want to argue about this, let's set a few guidelines as to what
> "powerful" means.  I propose these guidelines
>
> 1. Syntax highlighting

Yes.

> 2. Web server integration

Irrelevant, except insofar as it supports a real-time debugger.

> 3. Link checking
> 4. Browser check in the top three (Mozilla-IE-Opera)

These are both HTML editor features, not PHP editor features.  

For me, the big three features I want in a PHP dev environment are:

- Syntax highlighting.
- Context-sensitive code assistance.  I hate having to remember the order of 
parameters, especially when they're irregular.
- Real-time debugger.  The only one I've found that works for me so far is 
Zend's.  I cannot overstate how useful a real-time debugger is for tracking 
down bugs in complex applications.  


-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] most powerful php editor

2007-01-24 Thread tedd

At 9:07 PM -0500 1/24/07, Robert Cummings wrote:

Dear Mr Lynch, normally I highly respect your commentary on the list,
but today I think you've been-a-smoking the crackpipe a tad too much.

There is no way in hell one long line of SQL is easier to read than
formatted SQL that clearly delineates the clause structure.

SELECT A.field1 AS afield1, A.field2 AS afield2, B.field1 AS bfield1,
B.field2 AS bfield2, C.field1 AS cfield1, C.field2 AS cfield2, D.field1
AS dfield1, D.field2 AS dfield2 FROM tableA as A LEFT JOIN tableB AS B
ON B.fee = A.foo LEFT JOIN tableC AS C ON C.fii = B.fee LEFT JOIN tableD
AS D ON D.fuu = C.fii WHERE A.foo = 'someValue' ORDER BY afield1 ASC,
cfield2 ASC

The above line "should" be on one line, but my email client might
autowrap it. Either way, the following is formatted and is much clearer.

SELECT
A.field1 AS afield1,
A.field2 AS afield2,
B.field1 AS bfield1,
B.field2 AS bfield2,
C.field1 AS cfield1,
C.field2 AS cfield2,
D.field1 AS dfield1,
D.field2 AS dfield2
FROM
tableA as A
LEFT JOIN tableB AS B ON
B.fee = A.foo
LEFT JOIN tableC AS C ON
C.fii = B.fee
LEFT JOIN tableD AS D ON
D.fuu = C.fii
WHERE
A.foo = 'someValue'
ORDER BY
afield1 ASC,
cfield2 ASC


While the above is contrived, most of us know such examples happen quite
often in the wild. Not only is it easier to read, but the task of adding
or removing selected fields is trivial.

Cheers,
Rob.



Ahem to that!

You're on a roll brother -- keep going.

Can I get another Ahem?!

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] most powerful php editor

2007-01-24 Thread tedd

At 6:48 PM -0700 1/24/07, John Meyer wrote:

If we want to argue about this, let's set a few guidelines as to what
"powerful" means.  I propose these guidelines

1. Syntax highlighting
2. Web server integration
3. Link checking
4. Browser check in the top three (Mozilla-IE-Opera)

Now maybe you disagree, maybe you agree.  I'd love to just use vi and
type away, but quite frankly I'm not that smart.  And if you have your
own guidelines, let's hear them.


I'm not that smart either, but probably more so than you.  ;-)

I use GoLive for the Mac for all my html, javascript, ajax, dom 
scripting, php, and mysql development. It has a bunch of WYSIWYG junk 
that I seldom use.


But, it gives me: a great editor (syntax coloring throughout the 
different languages); allows me to develop real-time on the web 
(virtual host stuff); with universal link checking (i.e, change one, 
it changes the rest); excellent search and replace features; and an 
on-line/off-line directory structure that makes it very easy to 
update files to/from my server. Plus, it allows me to edit files via 
their parent application (i.e., Photoshop, GIF editor, Flash, 
whatever) while using GoLive.


As far as Browsers, GoLive can launch any Mac browser, but not IE -- 
there is no IE for Mac, other than IE5.2. As such, I use BrowserCam 
to check for layouts and I think that's a better way to check for css 
differences between browsers. I never observe any php/mysql 
differences.


The layout allows me to set-up my defaults to the way I want thing to 
be from what the doctypes my files are to be saved as to the way and 
type of helper windows I want.


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] most powerful php editor

2007-01-24 Thread Robert Cummings
On Wed, 2007-01-24 at 20:44 -0600, Larry Garfield wrote:
> On Wednesday 24 January 2007 8:07 pm, Robert Cummings wrote:
> 
> > There is no way in hell one long line of SQL is easier to read than
> > formatted SQL that clearly delineates the clause structure.
> 
> Sure there is.  If it's a very simple SQL statement.
> 
> I have at various times done all of the following, depending on the 
> complexity 
> of the statement in question:
> 
> SELECT id, foo, FROM foo_table WHERE id=5
> 
> (Too short to really bother with splitting up.)
> 
> SELECT id, foo, bar, baz
> FROM foo_table
>   INNER JOIN bar_table on a=b
>   LEFT OUTER JOIN baz_table on b=c
> WHERE blah
>   AND stuff < narf
>   OR (thingie AND other)
> ORDER BY foo
> 
> SELECT a.a, a.b, a.c
> b.d, b.e, b.f
>   FROM a
> INNER JOIN b ON whatever
> ORDER BY a.b, a.c DESC

I notice you formatted all of the "long" ones. That's why in my original
statement I wrote "There is no way in hell one long line". Subsequently,
I deem you to be in agreement with my point, despite the misguided
protest :B

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Larry Garfield
On Wednesday 24 January 2007 8:07 pm, Robert Cummings wrote:

> There is no way in hell one long line of SQL is easier to read than
> formatted SQL that clearly delineates the clause structure.

Sure there is.  If it's a very simple SQL statement.

I have at various times done all of the following, depending on the complexity 
of the statement in question:

SELECT id, foo, FROM foo_table WHERE id=5

(Too short to really bother with splitting up.)

SELECT id, foo, bar, baz
FROM foo_table
  INNER JOIN bar_table on a=b
  LEFT OUTER JOIN baz_table on b=c
WHERE blah
  AND stuff < narf
  OR (thingie AND other)
ORDER BY foo

SELECT a.a, a.b, a.c
b.d, b.e, b.f
  FROM a
INNER JOIN b ON whatever
ORDER BY a.b, a.c DESC

"Like any other programming language", or rather any language that isn't 
Python, formatting matters most to the reader, not to the program.  So, 
optimize your style for readability.  Readability is, of course, partially 
subjective so your style will differ from my style, but the key point is 
still to optimize the code for when you come back in 3-6 months to add a 
feature or find an obscure bug and don't remember what the frel you were 
doing.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Robert Cummings
On Wed, 2007-01-24 at 18:48 -0700, John Meyer wrote:
> Jochem Maas wrote:
> > Curt Zirzow wrote:
> >> On 1/20/07, Vinicius C Silva <[EMAIL PROTECTED]> wrote:
> >>> hi everyone!
> >>>
> >>> i'd like to ask something maybe commonly asked here. what is the most
> >>> powerful php editor?
> >>
> >> So now we have a 4 day thread of discussing nothing but, this is what i
> >> use
> > 
> > let see if we can make it a full week :-P
> 
> 
> If we want to argue about this, let's set a few guidelines as to what
> "powerful" means.  I propose these guidelines
> 
> 1. Syntax highlighting

Useful, but I stuck with joe for 3 years before they got syntax
highlighting. I like the editor that much :)

> 2. Web server integration

Why? Web servers read files. Editor's read and write files. Seems the
filesystem is plenty of glue.

> 3. Link checking

Ummm, what do you do about generated links? My experience has been that
ripping through the site towards the end of development with wget is
quite satisfactory.

> 4. Browser check in the top three (Mozilla-IE-Opera)

Huh? What's browser check? Don't you just test with each of the
browsers? IE works quite nicely with windows confined to a vmware
sandbox.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Robert Cummings
On Wed, 2007-01-24 at 18:23 -0600, Richard Lynch wrote: 
> On Wed, January 24, 2007 7:41 am, Roman Neuhauser wrote:
> > # [EMAIL PROTECTED] / 2007-01-24 13:57:03 +0200:
> >> and also in these days I'm looking for 19 inch (or more) wide LCD
> >> sceerns to able to fit longer lines in my screen...
> >
> > Number of reading errors people make grows with line length,
> > this has been known for as long as I remember.  You're increasing the
> > probability of bugs in the code, and get tired sooner because
> > following
> > long lines requires more energy.
> 
> I believe those results are specific to what is being read.
> 
> Surely it's easier to read:
> 
> SELECT blah, blah, blah, blah, blah, blah, blah, blah, blah
> 
> if it's all on one line, no matter how many fields there are, while
> trying to read the code as a whole.
> 
> Sure, it can be "hard" to find/read the individual field names, on the
> rare occasion that you need to do that...

Dear Mr Lynch, normally I highly respect your commentary on the list,
but today I think you've been-a-smoking the crackpipe a tad too much.

There is no way in hell one long line of SQL is easier to read than
formatted SQL that clearly delineates the clause structure.

SELECT A.field1 AS afield1, A.field2 AS afield2, B.field1 AS bfield1,
B.field2 AS bfield2, C.field1 AS cfield1, C.field2 AS cfield2, D.field1
AS dfield1, D.field2 AS dfield2 FROM tableA as A LEFT JOIN tableB AS B
ON B.fee = A.foo LEFT JOIN tableC AS C ON C.fii = B.fee LEFT JOIN tableD
AS D ON D.fuu = C.fii WHERE A.foo = 'someValue' ORDER BY afield1 ASC,
cfield2 ASC

The above line "should" be on one line, but my email client might
autowrap it. Either way, the following is formatted and is much clearer.

SELECT
A.field1 AS afield1,
A.field2 AS afield2,
B.field1 AS bfield1,
B.field2 AS bfield2,
C.field1 AS cfield1,
C.field2 AS cfield2,
D.field1 AS dfield1,
D.field2 AS dfield2
FROM
tableA as A
LEFT JOIN tableB AS B ON
B.fee = A.foo
LEFT JOIN tableC AS C ON
C.fii = B.fee
LEFT JOIN tableD AS D ON
D.fuu = C.fii
WHERE
A.foo = 'someValue'
ORDER BY
afield1 ASC,
cfield2 ASC


While the above is contrived, most of us know such examples happen quite
often in the wild. Not only is it easier to read, but the task of adding
or removing selected fields is trivial.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] most powerful php editor

2007-01-24 Thread John Meyer
Jochem Maas wrote:
> Curt Zirzow wrote:
>> On 1/20/07, Vinicius C Silva <[EMAIL PROTECTED]> wrote:
>>> hi everyone!
>>>
>>> i'd like to ask something maybe commonly asked here. what is the most
>>> powerful php editor?
>>
>> So now we have a 4 day thread of discussing nothing but, this is what i
>> use
> 
> let see if we can make it a full week :-P


If we want to argue about this, let's set a few guidelines as to what
"powerful" means.  I propose these guidelines

1. Syntax highlighting
2. Web server integration
3. Link checking
4. Browser check in the top three (Mozilla-IE-Opera)

Now maybe you disagree, maybe you agree.  I'd love to just use vi and
type away, but quite frankly I'm not that smart.  And if you have your
own guidelines, let's hear them.

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Jochem Maas
Curt Zirzow wrote:
> On 1/20/07, Vinicius C Silva <[EMAIL PROTECTED]> wrote:
>> hi everyone!
>>
>> i'd like to ask something maybe commonly asked here. what is the most
>> powerful php editor?
> 
> 
> So now we have a 4 day thread of discussing nothing but, this is what i
> use

let see if we can make it a full week :-P

> 
> 
> Curt.
> 

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



Re: [PHP] JPEG info needed

2007-01-24 Thread Gerry Danen

Richard,

imageinterlace() turns the interlace bit on or off. It only returns 1
if you set it to 1 as the second parameter...

Thanks

Gerry

On 1/24/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Wed, January 24, 2007 12:08 am, Gerry Danen wrote:
>> One other possibility is to see what happens if you do
>> imagefromjpeg()
>> on a progressive JPEG -- There amy be functions in GD that will tell
>> you if the JPEG is progressive, once you have sucked it into PHP...
>
> Any idea which ones to look at?

No, but a quick search on php.net for "JPEG progress" with "online
documentation" from the popup yeilded:

http://us3.php.net/manual/en/function.imageinterlace.php
"If the interlace bit is set and the image is used as a JPEG image,
the image is created as a progressive JPEG.

This function returns whether the interlace bit is set for the image. "

Presumably, then, this would work:





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



Re: [PHP] most powerful php editor

2007-01-24 Thread Curt Zirzow

On 1/20/07, Vinicius C Silva <[EMAIL PROTECTED]> wrote:

hi everyone!

i'd like to ask something maybe commonly asked here. what is the most
powerful php editor?



So now we have a 4 day thread of discussing nothing but, this is what i use


Curt.

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-24 18:23:10 -0600:
> On Wed, January 24, 2007 7:41 am, Roman Neuhauser wrote:
> > # [EMAIL PROTECTED] / 2007-01-24 13:57:03 +0200:
> >> and also in these days I'm looking for 19 inch (or more) wide LCD
> >> sceerns to able to fit longer lines in my screen...
> >
> > Number of reading errors people make grows with line length,
> > this has been known for as long as I remember.  You're increasing the
> > probability of bugs in the code, and get tired sooner because
> > following
> > long lines requires more energy.
> 
> I believe those results are specific to what is being read.
> 
> Surely it's easier to read:
> 
> SELECT blah, blah, blah, blah, blah, blah, blah, blah, blah

Not for me.

SQL is just another programming language, and I fail to see why
principles of programming hygiene shouldn't apply to it.
 
> Sure, it can be "hard" to find/read the individual field names, on the
> rare occasion that you need to do that...
 
Like, on the "rare" occasion that you need to find a bug in a program
with poor formatting.

> Assuming you actually planned your DB and queries out to fit your
> application needs in the first place.  I guess if you're coding in an
> unstructured iterative way to design the db, then, yeah, it would be
> harder on the eyes as you morph that statement into what it should
> be...
> :-v

That's a strong argument against indenting source code: all you need is
a solid design upfront!  Of course, if your queries sum up to blah,
blah, blah, it might not be worth designing them in the first place.

:-^

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



RE: [PHP] where match question

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 12:53 am, Don wrote:
> zips are fixed, but my clients have districts that I want to be
> searched by
> zip+4. Each client will have a different district with different zips
> per
> district.
> They are to input the zips that are within their district when they
> sign up,
> and that data is used to display relevant profiles when a user inputs
> their
> zip.
>
> As best as I can figure, the best way to do this with full text db
> fields
> where the zips are inputted separated by comas.
>
> I am currently trying to get WHERE MATCH () AGAINST to do the trick,
> but I
> am going to play with some of these other suggestions
>
> I am very new to programming, just fyi.

Actually, if you are trying to match people up with their ZIP codes,
you would probably be best off taking the ZIP (and possibly address)
input, converting it to latitude/longitude with something like Google
or Yahoo services, and then using a simple distance function to find
nearest matches.

It's entirely possible for this situation, especially in rural areas:

---|-
Zip Code: X  User X|Vendor B
   | Zip Code: Y
Vendor A   |
-
Legend: - equals 10 miles, newline = 10 miles

As you can see, User X is MUCH closer to Vendor B, but Vendor A is in
their zip code.

Once you geo-code their address correctly (which is a challenge to get
right, I admit) you can end up providing MUCH better service to the
end user.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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] where match question

2007-01-24 Thread Richard Lynch
On Tue, January 23, 2007 11:49 pm, Don wrote:
> I appreciate all the input. I would definitely like to use a separate
> table
> for the zips, but I cannot figure out how make the form that stores
> them
> user friendly each entry can have any number of zips - from many
> to just
> a few.
>
> Also, the site is in development, so there is no existing data
>
> I will play with LIKE for the time being.

You could keep the FORM the same, but use http://php.net/explode to
put separate records into the database, and http://php.net/implode to
show the zips in the FORM.

Depending on the application, you may want to have separate INPUT
fields for pre-existing zips in the DB, with no implode, and only a
big-ass INPUT for NEW zips with commas to go into the DB.

It's also possible to play games with CSS and/or JS and extra INPUT
fields to have the number of available INPUT fields be dynamic as they
add more and more zips in the browser.

YMMV

It's probably best to stop and think about what's the BEST way for
people to do this task, the best business process, and then ask how to
achieve that, rather than pushing the Design to match your (current)
PHP limitations. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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] How to make Browse Folder Dialog

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 1:11 am, Travis Doherty wrote:
> Aslam Bari wrote:
>
>>Hello,
>>Just a minute. I know the php script will run on server. Suppose i m
>> working
>>on server machine and i need to make a project for myself. The
>> machine is
>>only one and same. Also there are a lot of file and directory methods
>>available in PHP, Whats that? Actually i want to show the files of
>> selected
>>folder on screen.

Perhaps PHP GTK has a dialog like you want...
:-)


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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] Validating a link in php

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 10:25 am, [EMAIL PROTECTED] wrote:
> I'm hoping y'all can help me with a bit of a php code problem I'm
> having.
>
> What I'm trying to do is link to YouTube videos (more than one in a
> single
> webpage).  However, because I'm worried about the videos going away
> and the
> links going bad, I'd like to use PHP to check if the link is good; if
> it's
> good, display the video link, else display a static image that I have
> on my
> servers.
>
> Where I'm having troubles is in the checking of whether the url is
> good.  I
> think part of the problem is YouTube itself.  I've tried file() and
> fsockopen(), but neither seem to work.

The problem with 'file' is that you are trying to suck down the ENTIRE
video, probably...

I dunno what you did wrong with fsockopen...

I personally would have done fopen and read the headers to see if it
was valid.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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] Regular Expression Problem

2007-01-24 Thread Jochem Maas
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-24 23:55:27 +0100:
>> Roman Neuhauser wrote:
>>> Are you doing this to learn regular expressions or are you actually
>>> trying to do work? Because you're going the wrong way.
>>> It's XML, why do you treat it as text?
>> not everyone shares that sentiment. in terms of lowest common denominator
>> XML is also a string. then there is the question of whether it's actually
>> marked as XML, whether there is valid DTD and whether the XML itself 
>> validates
>> against the DTD - if any of the answers is 'no' then your looking at tag 
>> soup.
> 
> as long as it's wellformed he can use it for what it is: a serialized
> composite structure, like the result of serialize($aTreeOfObjects).
> You can use preg_match() to extract a subset of the tree, but why bother
> if you have unserialize($aTreeOfObjects)->getElementById("foo")?

nothing to do with this argument but:

this reminds of a thread on internals where someone was trying to determine
if a serialized data was *safe* to run ... the data was coming from a cookie (I 
think),
unserializing the data without first checking it didn't contain something
evil was a bad idea - the proposed solution was a fairly simple regex
that checked for 'object' notation in the serialized string. :-)


>  

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 7:41 am, Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-24 13:57:03 +0200:
>> and also in these days I'm looking for 19 inch (or more) wide LCD
>> sceerns to able to fit longer lines in my screen...
>
> Number of reading errors people make grows with line length,
> this has been known for as long as I remember.  You're increasing the
> probability of bugs in the code, and get tired sooner because
> following
> long lines requires more energy.

I believe those results are specific to what is being read.

Surely it's easier to read:

SELECT blah, blah, blah, blah, blah, blah, blah, blah, blah

if it's all on one line, no matter how many fields there are, while
trying to read the code as a whole.

Sure, it can be "hard" to find/read the individual field names, on the
rare occasion that you need to do that...

Assuming you actually planned your DB and queries out to fit your
application needs in the first place.  I guess if you're coding in an
unstructured iterative way to design the db, then, yeah, it would be
harder on the eyes as you morph that statement into what it should
be...
:-v

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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] Regular Expression Problem

2007-01-24 Thread Jochem Maas
Richard Luckhurst wrote:
> Hi Jochem,
> 
> JM> 
> JM> you be needing an ungreedy modifier on yer regex.
> JM> 
> 
> JM> see here:
> JM> http://php.net/manual/en/reference.pcre.pattern.modifiers.php
> 
> Thanks very much. That solved my problem and I my now getting exactly what I
> want. I had seen the reference to greedy and ungreedy but had not understood 
> the
> concept.

for a better understanding I recommend the film WallStreet - that
should get you up to speed on the concept of greed ;-)

> 
> Regards
> 
> Richard
> 
> 

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



Re: [PHP] Unserialize problem (and or bug)

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 9:17 am, Sancar Saran wrote:
> After updating company test server to dotdeb 5.2.0 it star to give
> memory
> problems (even 32mb session). I tought it was because of suhosin. And
> I
> cannot update that server to vanilla debian php5 package because it
> was a
> sarge so today my company gives me another debian etch (like my home
> pc). I
> setup latest php 5.2.0.8 for debian etch.
>
> Then unserialize gives another problem
>
> Message: unserialize(): Error at offset 1384 of 3177 bytes
> Code: 8
> Line: 419
>
> My pc uses debian etch and have php 5.1.6-5 my scripts working
> normally.
>
> Is there any suggestion for handle this ?

What is in the data at byte 1384 that can't be unserialized?


Are you trying to take data serialized by one version of PHP and
unserialize it with another?

That does not work in current versions, though discussion on Internals
lends hope that future versions will be able to deal intelligently
with this situation.


Check http://bugs.php.net/ for similar bugs -- there may be a patch.

Also check with suhosin and Debian bug tracking, as it may be specific
to either of those.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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] Debugging itpc

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 1:01 pm, Skip Evans wrote:
> Hey all,
>
> I'm working on a site that allows users to build
> libraries of podcasts, and one of the calls to a
> PHP file is itpc, not http.
>
> Hence I don't have the ability to echo data for
> debugging, and I also don't have write access to
> any dirs to fopen and fwrite data.
>
> Any suggestions for other ways to debug this
> script file?

http://php.net/error_log
might be able to send error messages to your Apache or system log,
depending on the settings of php.ini
You could even go so far as emailing the errors to yourself, though
that obviously is rife with possiblities of abuse in a Production
environment...

http://php.net/set_error_handler
may come in handy to automate handling the errors once you figure out
how to do it.

Convincing the server admin to give you a directory outside the
webtree where you can have PHP writing error log data should not be
too terribly difficult...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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] Regular Expression Problem

2007-01-24 Thread Richard Lynch
You want to add a 'U' after you closing # so that matches are
"Ungreedy" -- I.e., they do NOT grab as much text as the can to
fulfill the pattern (greedy) but they grab as LITTLE text as they can
to fulfill the pattern (ungreedy)

On Wed, January 24, 2007 4:27 pm, Richard Luckhurst wrote:
> Hi List
>
> I must be dumb as I have been battling my way through regular
> expression
> examples for a while and I can not work out why the following does not
> work
> properly. I am the first to admit that regular expressions confuse me
> greatly.
>
> The string is a piece of XML as follows and I have put that string
> into a
> variable called $xml_string
>
>
> 
>   addChdPrice="0.0" addInfPrice="0.0">
>  
> class="V">
> class="V">
>  
>  
>   addChdPrice="0.0" addInfPrice="0.0">
>  
> class="V">
> class="V">
>  
>  
> 
>
>
> What I am trying to do is extract the first 
> chunk.
>
> I am using the following, based on the example at
> http://php.net/manual/en/function.preg-match.php example 3
>
> preg_match('##', $xml_string,$matches);
> $tempstr = $matches[0];
>
> What I actually get in $tempstr is everything from the first  through to
> the last (second) 
>
> I would have expected preg_match to have matched from the first
>  to the first .
>
> I suspect I do not have the regular expression correct. I would great
> appreciate
> any help on sorting out the regular expression so that it only returns
> the first
> chunk of the string.
>
>
>
> Regards,
> Richard Luckhurst
>
> --
> 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 starving artist.
http://cdbaby.com/browse/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] Regular Expression Problem

2007-01-24 Thread Paul Novitski

At 1/24/2007 02:27 PM, Richard Luckhurst wrote:

What I am trying to do is extract the first  chunk.

...

preg_match('##', $xml_string,$matches);
$tempstr = $matches[0];

What I actually get in $tempstr is everything from the first through to

the last (second) 

I would have expected preg_match to have matched from the first 

to the first .



At 1/24/2007 02:55 PM, Jochem Maas wrote:


you be needing an ungreedy modifier on yer regex.


see here:
http://php.net/manual/en/reference.pcre.pattern.modifiers.php



You can also ask regexp to return the text up to but not including 
the next '<':


#http://juniperwebcraft.com 


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



[PHP] Re: Package php code

2007-01-24 Thread Gregory Beaver
Peter Lauri wrote:
> Hi,
> 
>  
> 
> Is there any similar way to package PHP software as Java with a jar file or
> similar? I have never seen it, because then would probably Smarty for
> example be packaged already :-) This question came out of the blue when I
> was thinking about how to deliver some plugins to a customer.

The only live example of a php jar (phar) is bundled with PHP newer than
PHP 5.1.0, and you can see it at http://pear.php.net/go-pear.phar or
http://pear.php.net/install-pear-nozlib.phar.  These packages were
created using the PHP_Archive package at
http://pear.php.net/PHP_Archive.  There is also an unrelated project
that calls itself PHK that claims to have more features, but I have not
tried it.

Although PHP_Archive-based phars work, I've been working with Marcus
Boerger on the native PHP extension Phar (http://pecl.php.net/phar)
which will allow far more flexibility and power as well as performance.
 However, any software that relies upon include_path needs to be
modified to work with phar, which can be a royal pain, depending on how
it was designed initially.  The best example of the packaging script
that might be necessary is at
http://cvs.php.net/viewvc.cgi/pear-core/make-gopear-phar.php

Greg

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



Re[2]: [PHP] Regular Expression Problem

2007-01-24 Thread Richard Luckhurst
Hi Jochem,

JM> 
JM> you be needing an ungreedy modifier on yer regex.
JM> 

JM> see here:
JM> http://php.net/manual/en/reference.pcre.pattern.modifiers.php

RL Thanks very much. That solved my problem and I my now getting exactly what I
RL want. I had seen the reference to greedy and ungreedy but had not understood 
the
RL concept.

RL Regards

RL Richard

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



RE: [PHP] Multi lingual pages

2007-01-24 Thread Ligaya A. Turmelle
This article was released just a couple days ago -
http://www-128.ibm.com/developerworks/library/os-php-intl/index.html 


Respectfully,
Ligaya Turmelle
Systems Analyst
Guamcell Communications
Phone: (671)689-2377 
-Original Message-
From: Otto Wyss [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 25, 2007 7:44 AM
To: php-general@lists.php.net
Subject: [PHP] Multi lingual pages

I'd like to make my pages multi lingual, showing everything in the
language the user chooses. My pages show mostly static text. So what's
the usual implementation for this case.

O. Wyss

--
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] Regular Expression Problem

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-25 09:27:59 +1100:
> 
>   addInfPrice="0.0">
>  
>
>
>  
>  
>   addInfPrice="0.0">
>  
>
>
>  
>  
> 
> 
> 
> What I am trying to do is extract the first  chunk.
 
> preg_match('##', $xml_string,$matches);
> $tempstr = $matches[0];
> 
> What I actually get in $tempstr is everything from the first  to
> the last (second) 
 
Strange, you should have gotten nothing:

s (PCRE_DOTALL)

If this modifier is set, a dot metacharacter in the pattern matches
all characters, including newlines. Without it, newlines are
excluded.

> I would have expected preg_match to have matched from the first  through
> to the first .

As Jochem wrote, you also need U (PCRE_UNGREEDY).

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Regular Expression Problem

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-24 23:55:27 +0100:
> Roman Neuhauser wrote:
> > Are you doing this to learn regular expressions or are you actually
> > trying to do work? Because you're going the wrong way.
> > It's XML, why do you treat it as text?
> 
> not everyone shares that sentiment. in terms of lowest common denominator
> XML is also a string. then there is the question of whether it's actually
> marked as XML, whether there is valid DTD and whether the XML itself validates
> against the DTD - if any of the answers is 'no' then your looking at tag soup.

as long as it's wellformed he can use it for what it is: a serialized
composite structure, like the result of serialize($aTreeOfObjects).
You can use preg_match() to extract a subset of the tree, but why bother
if you have unserialize($aTreeOfObjects)->getElementById("foo")?
 
-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Regular Expression Problem

2007-01-24 Thread Jochem Maas
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-25 09:27:59 +1100:
>> I must be dumb as I have been battling my way through regular expression
>> examples for a while and I can not work out why the following does not work
>> properly. I am the first to admit that regular expressions confuse me 
>> greatly.
>>
>> The string is a piece of XML as follows and I have put that string into a
>> variable called $xml_string
>>
>>
>> 
>>  > addInfPrice="0.0">
>>  
>>
>>
>>  
>>  
>>  > addInfPrice="0.0">
>>  
>>
>>
>>  
>>  
>> 
>>
>>
>> What I am trying to do is extract the first  chunk.


you be needing an ungreedy modifier on yer regex.


see here:
http://php.net/manual/en/reference.pcre.pattern.modifiers.php

> Are you doing this to learn regular expressions or are you actually
> trying to do work? Because you're going the wrong way.
> It's XML, why do you treat it as text?

not everyone shares that sentiment. in terms of lowest common denominator
XML is also a string. then there is the question of whether it's actually
marked as XML, whether there is valid DTD and whether the XML itself validates
against the DTD - if any of the answers is 'no' then your looking at tag soup.

there is a lot more tagsoup in this world than there is proper xml.

that said it can't hurt to throw simpleXML at the problem :-)

> 

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



Re[2]: [PHP] Regular Expression Problem

2007-01-24 Thread Richard Luckhurst
Hi Roman,

RN> Are you doing this to learn regular expressions or are you actually
RN> trying to do work? Because you're going the wrong way.
RN> It's XML, why do you treat it as text?

I am well aware it is XML and I could use an XML parser or simpleXML. I am
trying to learn regular expressions as I have a fair bit of work coming up that
will require the use pattern matching within strings. It just so happens that
some of the data looks like XML, hence the reason I am using a piece of XML for
this learning process.


Regards

Richard

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



Re: [PHP] Regular Expression Problem

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-25 09:27:59 +1100:
> I must be dumb as I have been battling my way through regular expression
> examples for a while and I can not work out why the following does not work
> properly. I am the first to admit that regular expressions confuse me greatly.
> 
> The string is a piece of XML as follows and I have put that string into a
> variable called $xml_string
> 
> 
> 
>   addInfPrice="0.0">
>  
>
>
>  
>  
>   addInfPrice="0.0">
>  
>
>
>  
>  
> 
> 
> 
> What I am trying to do is extract the first  chunk.
 
Are you doing this to learn regular expressions or are you actually
trying to do work? Because you're going the wrong way.
It's XML, why do you treat it as text?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Multi lingual pages

2007-01-24 Thread Paul Novitski

At 1/24/2007 01:44 PM, Otto Wyss wrote:
I'd like to make my pages multi lingual, showing everything in the 
language the user chooses. My pages show mostly static text. So 
what's the usual implementation for this case.



This is a vast subject that deserves general study.  I recommend that 
you goggle PHP MULTILINGUAL for many resources, and check out these articles:


W3C Web Internationalization Articles
http://www.w3.org/International/articles/

Internationalization Best Practices: Specifying Language in XHTML & 
HTML Content

http://www.w3.org/TR/i18n-html-tech-lang/

At this early point in your learning, your question seems too general 
for a PHP listserve, although PHP makes a fine programming language 
for international websites, e.g.:

http://php.net/setlocale


I implement multilingual pages in two ways:

1) Switching language downloads a new version of the current page, 
generally with the same markup but new text.  Example:

http://partcon.ca/

2) Downloading all languages in the same page, hiding all but one 
with CSS and revealing other immediately when the language toggle is 
activated.  Example:

http://laurietobyedison.com/WOJwords.asp?lang=JP

In both cases I store the text in database tables that contain a 
language field I can select on to match the user's request.


Regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com  


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



Re: [PHP] JPEG info needed

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 12:08 am, Gerry Danen wrote:
>> One other possibility is to see what happens if you do
>> imagefromjpeg()
>> on a progressive JPEG -- There amy be functions in GD that will tell
>> you if the JPEG is progressive, once you have sucked it into PHP...
>
> Any idea which ones to look at?

No, but a quick search on php.net for "JPEG progress" with "online
documentation" from the popup yeilded:

http://us3.php.net/manual/en/function.imageinterlace.php
"If the interlace bit is set and the image is used as a JPEG image,
the image is created as a progressive JPEG.

This function returns whether the interlace bit is set for the image. "

Presumably, then, this would work:



-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/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



[PHP] Regular Expression Problem

2007-01-24 Thread Richard Luckhurst
Hi List

I must be dumb as I have been battling my way through regular expression
examples for a while and I can not work out why the following does not work
properly. I am the first to admit that regular expressions confuse me greatly.

The string is a piece of XML as follows and I have put that string into a
variable called $xml_string



 
 
   
   
 
 
 
 
   
   
 
 



What I am trying to do is extract the first  chunk.

I am using the following, based on the example at
http://php.net/manual/en/function.preg-match.php example 3

preg_match('##', $xml_string,$matches);
$tempstr = $matches[0];

What I actually get in $tempstr is everything from the first 

I would have expected preg_match to have matched from the first .

I suspect I do not have the regular expression correct. I would great appreciate
any help on sorting out the regular expression so that it only returns the first
chunk of the string.



Regards,
Richard Luckhurst

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



[PHP] Re: Multi lingual pages

2007-01-24 Thread zerof

Otto Wyss escreveu:
I'd like to make my pages multi lingual, showing everything in the 
language the user chooses. My pages show mostly static text. So what's 
the usual implementation for this case.


O. Wyss

To to this, I use the GeoIP database.
For me, it works fine!

http://www.maxmind.com/app/ip-location
--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
--
Você deve, sempre, consultar uma segunda opinião!
--  
You must hear, always, one second opinion! In all cases.
--

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



RE: [PHP] preg_match problem

2007-01-24 Thread Paul Novitski

At 1/24/2007 01:13 PM, Beauford wrote:

> Here is my rendition of what I think you are looking for.
>
> $str = 'tab(  )/space( )/[EMAIL PROTECTED]&*();:...';
>
> if ( preg_match('|[EMAIL PROTECTED]&*();:_. /\t-]+$|', $str) ) {
>   echo 'success';
> } else {
>   echo 'failure';
> }
>

Here is the problem, and it is strange. If I enter each of the above
characters into my form one at a time and hit submit after each one, NO
error is produced for any of them.

If I cut and past this all at once:  [EMAIL PROTECTED]&*();:_.\ then an error
IS returned.


Are you really including a backslash as your final character?  Are 
you escaping it?  Is the error you're getting the result of the 
sequence \" or \' which eats up your ending delimiter?


Beauford, all of this stuff you're trying to do is elementary regular 
expression work.  The problems you're having are undoubtedly very 
easy to solve, but so far helping you has been guesswork because we 
haven't actually seen the scripts you're actually running.  To help 
us help you get past this log jam, give us all the material we need 
to analyze your problem.


1) Specify exactly which error messages you're getting.
2) Give us an URL to a test page that displays the strings and 
patterns and the error messages that result.
3) Copy the PHP script in step 2) with a .txt file extension and post 
that as well so we can proofread your code.


My own personal experience is that if you document and demonstrate 
your problem well enough that someone else can actually help you, the 
chances are that doing so will reveal the solution to you, like magic.


Regards,

Paul
__

Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



[PHP] Multi lingual pages

2007-01-24 Thread Otto Wyss
I'd like to make my pages multi lingual, showing everything in the 
language the user chooses. My pages show mostly static text. So what's 
the usual implementation for this case.


O. Wyss

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



RE: [PHP] preg_match problem

2007-01-24 Thread Beauford
> Here is my rendition of what I think you are looking for.
> 
> $str = 'tab(  )/space( )/[EMAIL PROTECTED]&*();:...';
> 
> if ( preg_match('|[EMAIL PROTECTED]&*();:_. /\t-]+$|', $str) ) {
>   echo 'success';
> } else {
>   echo 'failure';
> }
> 

Here is the problem, and it is strange. If I enter each of the above
characters into my form one at a time and hit submit after each one, NO
error is produced for any of them.

If I cut and past this all at once:  [EMAIL PROTECTED]&*();:_.\ then an error
IS returned.
If I continue to remove one character at a time, submitting the form each
time, errors ARE still produced.

This is the code in a nutshell:

If(isset($submit)) {

$name = stripslashes($_POST['name']);  >> I have tried this with and
without

$formerror = array(); unset($result);  >> I have tried this with and
without

if($result = ValidateString($name)) { $formerror['name'] =
$invalidcharacters;

Function ValidateString($string) {
if (!preg_match('|[EMAIL PROTECTED]&*();:_. /\t-]+$|',
$string) ) {
return invalidchars;
}
}
}







Thanks

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



Re: [PHP] Package php code

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-24 21:34:43 +0200:
> Is there any similar way to package PHP software as Java with a jar file or
> similar? I have never seen it, because then would probably Smarty for
> example be packaged already :-) This question came out of the blue when I
> was thinking about how to deliver some plugins to a customer.

I haven't tried it at all yet, but look for "phar".

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



RE: [PHP] Package php code

2007-01-24 Thread Jay Blanchard
[snip]
Is there any similar way to package PHP software as Java with a jar file
or
similar? I have never seen it, because then would probably Smarty for
example be packaged already :-) This question came out of the blue when
I
was thinking about how to deliver some plugins to a customer.
[/snip]

http://www.priadoblender.com

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



Re: [PHP] Debugging itpc

2007-01-24 Thread Robert Cummings
On Wed, 2007-01-24 at 12:01 -0700, Skip Evans wrote:
> Hey all,
> 
> I'm working on a site that allows users to build 
> libraries of podcasts, and one of the calls to a 
> PHP file is itpc, not http.
> 
> Hence I don't have the ability to echo data for 
> debugging, and I also don't have write access to 
> any dirs to fopen and fwrite data.
> 
> Any suggestions for other ways to debug this 
> script file?

It's slow, but it works...

mail()

:)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re[2]: [PHP] How to make Browse Folder Dialog

2007-01-24 Thread karo bugumyan

http://cwashington.netreach.net/depo/default.asp?topic=repository&move=next&ScriptType=vbscript&SubType=Misc

Script:

'
' FolderSelectDialog.vbs
' Alan Kaplan alan at akaplan dot com 12-15-2005
' after getting tired of reading it will not work...
' Based in part on FileSelectDialog.vbs by Gunter Born
' Kaplan added handling of special folders
' Tested okay with XP and 2000
' Uses the shell browseforfolder method to select a folder
'
Option Explicit

' Flags for the options parameter
Const BIF_returnonlyfsdirs = &H0001'Don't want no steenkin' filenames
Const BIF_ShowAllObjects  = &H0008'ReturnFSAncestors. This will give 
you typical root view
'XP has My Computer, My Network Places 
not seen on 2000
Const BIF_editbox = &H0010'Show active selection, allows manual input

Dim wshShell
'Wscript object
Set wshShell = WScript.CreateObject("WScript.Shell")

'=== Example ===
Dim strFolder

StrFolder = BrowseForFolder("Choose a folder, then click OK:", _
BIF_returnonlyfsdirs + BIF_editbox + BIF_ShowAllObjects,"")

If Len(strFolder)>0 Then
MsgBox strFolder,vbOKOnly, "Selected Folder"
End If 

'= End Example ===

Function BrowseForFolder(title, flag, dir)
' title = Text shown in the dialog box
' flag = values controlling BrowseForFolder behavior
' dir = Initial directory (can be ""). 
'dir most useful when not using BIF_ShowAllObjects 
On Error Resume Next
Dim oShell, oItem, strSelection

' Create Shell object.
Set oShell = WScript.CreateObject("Shell.Application")

' Invoke Browse For Folder dialog box.
Set oItem = oShell.BrowseForFolder(&H0, title, flag, dir)
strSelection = oItem.Title 
If Err <> 0 Then 'cancelled
Set oShell = Nothing
Set oItem = Nothing
Exit Function
End If

' If colon found then get drive letter from the title. No array
If InStr(strSelection, ":") Then 
BrowseForFolder = mid(strSelection,InStr(strSelection, ":")-1, 2)
Else
'Handle all other special cases where path not returned 
Select Case strSelection
Case "Desktop"
BrowseForFolder = wshShell.SpecialFolders("Desktop")
Case "My Documents"
BrowseForFolder = wshShell.SpecialFolders("MyDocuments")
Case "My Computer"
MsgBox "Invalid selection",vbCritical + vbOKOnly,"Error"
WScript.Quit
Case "My Network Places"
MsgBox "Invalid selection",vbCritical + vbOKOnly,"Error"
WScript.Quit
Case Else
 ' Finally try to retrieve the full path a la Born
 BrowseForFolder = oItem.ParentFolder.ParseName(oItem.Title).Path
End Select
End If

'Cleanup 
Set oShell = Nothing
Set oItem = Nothing

'make sure they all end in \
If Right(browseForFolder,1)<> "\" Then
browseforfolder = browseforfolder & "\"
End If

'Alternate make sure they all end without \
' If Right(browseForFolder,1) = "\" Then
' browseforfolder = left(BrowseForFolder,Len(BrowseForFolder)-1)
' End If

On Error GoTo 0
End Function

Wednesday, January 24, 2007, 9:51:24 AM, you wrote:


> Hello,
> Just a minute. I know the php script will run on server. Suppose i m working
> on server machine and i need to make a project for myself. The machine is
> only one and same. Also there are a lot of file and directory methods
> available in PHP, Whats that? Actually i want to show the files of selected
> folder on screen.
> Thanks...


> Travis Doherty-2 wrote:
>> 
>> Borge Holen wrote:
>> 
>>>On Wednesday 24 January 2007 07:32, Travis Doherty wrote:
>>>  
>>>
Aslam Bari wrote:


>Dear All,
>I m new in this Forum. I m making a project in which i need to show user
> a
>Browse Folder Dialog Box, In which he can select a folder and after this
> i
>will do some manipulation on that folder's content. So the problem is
> that
>i could not found any sample on Web , how to show "Folder Dialog" in any
>way (HTML, JavaScript, PHP etc). Plz has anybody some idea how to do
> some
>work around this.
>
>Thanks...
>  
>
PHP won't let you edit files on your users' computer.  Ever.

Maybe it would be worth your time to look into a different language to
do whatever it is you want to do, something like Visual Basic might suit
you well (last time I used it there was a control that would popup the
standard windows 'Select Folder' dialog.)

Travis Doherty


>>>
>>>Ouch, this is close to swearing in the church...
>>>
>>>  
>>>
>> :p  I suppose it is.  Use the right tool for the job right?  PHP on a
>> server won't ever let the OP manipulate the content of a folder on his
>> users computer.
>> 
>> T
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe

Re: [PHP] Debugging itpc

2007-01-24 Thread Skip Evans

Hey Robert,

Oh, of course. Heck, I was already trying to 
fwrite to a file so that should have occurred me...


...if I hadn't done all that acid in the 60s, and 
I was only FIVE in the 60s!


Thanks for clearing the fog.

Skip

Robert Cummings wrote:

On Wed, 2007-01-24 at 14:07 -0500, Robert Cummings wrote:


On Wed, 2007-01-24 at 12:01 -0700, Skip Evans wrote:


Hey all,

I'm working on a site that allows users to build 
libraries of podcasts, and one of the calls to a 
PHP file is itpc, not http.


Hence I don't have the ability to echo data for 
debugging, and I also don't have write access to 
any dirs to fopen and fwrite data.


Any suggestions for other ways to debug this 
script file?


It's slow, but it works...

   mail()



You can also just pump messages to a database table :)

Cheers,
Rob.


--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

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



Re[2]: [PHP] proxy

2007-01-24 Thread karo bugumyan

Dear Roman,

Unfortunately, I did not find any examples on the net on using connect.c with
PHP. Could anyone provide me with some examples, please?

Thank you.

Best regards,
Ed

Sunday, January 21, 2007, 6:27:44 PM, you wrote:

> # [EMAIL PROTECTED] / 2007-01-21 17:29:56 +0300:
>> I am trying to create a link checker that would look for broken URLs
>> with help of the following code"
>> 
>> $handle = @fopen("http://www.circle.am";, "r");
>> if ($handle):
>> print "OK";
>> else:
>> print "Error";
>> endif;
>> 
>> The problem is that I want to check if the links are accessible under
>> certain proxy, so is there any way to tell the script to open the URL
>> under a proxy?

> Several, start by googling for connect.c

> -- 
> How many Vietnam vets does it take to screw in a light bulb?
> You don't know, man.  You don't KNOW.
> Cause you weren't THERE. http://bash.org/?255991

--

http://www.freenet.am/

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



Re: [PHP] most powerful php editor

2007-01-24 Thread tedd

At 10:04 AM -0500 1/24/07, Jon Anderson wrote:

Miles Thompson wrote:
More seriously, many times I've taken a "It's right, but not 
working, dammit!" SQL statement,

broken it up so it's listed "vertically" and discovered the error.

Just my 2 cents worth...

SQL actually does lend itself rather well to normal code style 
indenting, even though not many seem to do it...Breaking it (and PHP 
code of course) into 78/80-char lines makes great sense for 
readability within PHP code:


-snip-

These things are a real pain to read without formatting! :-)

I think writing unformatted SQL queries is like writing code like 
"if ($var) { statement; statement; statement; foreach ($var as $v) { 
statement; statement; statement; } statement; etc. }"


jon


jon:

That's nice -- never thought about that -- thanks.

As for monitor size, I've noticed over the years that my function 
size increased with the height of my monitor.


The width of my monitors didn't affect much because I've always 
worked with one line, one statement and most statements are shorter 
than 80 characters. However, having more than one monitor (I have 
three) is absolutely great in that I can have several windows open at 
the same time.


As for 12 inch monitors, I remember my old Apple ][ with a 9 inch 
monitor (not Apple, I think Sanyo) that I used with a real-time 
analog video camera, graphic tablet for digitizing, and the 
computer's text and graphics were drawn on top of everything -- now 
that was small, but it worked great. I could digitize the head of 
Lincoln from a penny.


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] To many connections error message

2007-01-24 Thread Lic.Eduardo Ricardo Hernández Osorio
Hi Pinter:
Look at your php.ini file for the sentence 
error_reporting  =  E_ALL
this mean that your server shut to your browser any error or warning that it
found in your php code. You must go to your php.ini and change that sentence
for any that disables all warnings. 
You can use for example a combination of next:
 E_ERROR   - fatal run-time errors
 E_WARNING - run-time warnings (non-fatal errors)
 E_PARSE   - compile-time parse errors
 E_NOTICE  - run-time notices (these are warnings which often result
from a bug in your code, but it's possible that it was
intentional (e.g., using an uninitialized variable and
relying on the fact it's automatically initialized to an
empty string)
 E_STRICT  - run-time notices, enable to have PHP suggest changes
 to your code which will ensure the best
interoperability
 and forward compatability of your code
 E_CORE_ERROR  - fatal errors that occur during PHP's initial startup
 E_CORE_WARNING- warnings (non-fatal errors) that occur during PHP's
 initial startup
 E_COMPILE_ERROR   - fatal compile-time errors
 E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
 E_USER_ERROR  - user-generated error message
 E_USER_WARNING- user-generated warning message
 E_USER_NOTICE - user-generated notice message

An example:
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR 
this shows only all error types.

Sl2,
Richard
__
Eduardo Ricardo Hernández Osorio
Esp. "C" en Ciencias Informáticas
Grupo Informática, U.T.B Serv. Aeronáuticos
Aeropuerto Internacional "Frank País García"
Tel. (53)(24)(47 4569)
email: [EMAIL PROTECTED]

Airport´s Telephones: (53) (24) 462512, 474525, 474583 Ext: 4569 


-Mensaje original-
De: Pintér Tibor [mailto:[EMAIL PROTECTED] 
Enviado el: Tuesday, January 23, 2007 7:56 PM
Para: Chris
CC: php
Asunto: Re: [PHP] To many connections error message

Chris írta:
> Pintér Tibor wrote:
>> @, or ask your hoster to disable display_errors
>
> That can be done in the script ;)
>
> ini_set('display_errors', false);
>
Sure it can, but its a lame host that enables displaying of errors by 
default, thats why I advised to ask them to disable it globally :)

btw: Although display_errors may be set at runtime (with *ini_set()* 
), it won't have any 
affect if the script has fatal errors. This is because the desired 
runtime action does not get executed.

t

-- 
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] Debugging itpc

2007-01-24 Thread Robert Cummings
On Wed, 2007-01-24 at 14:07 -0500, Robert Cummings wrote:
> On Wed, 2007-01-24 at 12:01 -0700, Skip Evans wrote:
> > Hey all,
> > 
> > I'm working on a site that allows users to build 
> > libraries of podcasts, and one of the calls to a 
> > PHP file is itpc, not http.
> > 
> > Hence I don't have the ability to echo data for 
> > debugging, and I also don't have write access to 
> > any dirs to fopen and fwrite data.
> > 
> > Any suggestions for other ways to debug this 
> > script file?
> 
> It's slow, but it works...
> 
> mail()

You can also just pump messages to a database table :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Debugging itpc

2007-01-24 Thread Skip Evans

Hey all,

I'm working on a site that allows users to build 
libraries of podcasts, and one of the calls to a 
PHP file is itpc, not http.


Hence I don't have the ability to echo data for 
debugging, and I also don't have write access to 
any dirs to fopen and fwrite data.


Any suggestions for other ways to debug this 
script file?

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

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



[PHP] Validating a link in php

2007-01-24 Thread sleestak2
Hi all,

I'm hoping y'all can help me with a bit of a php code problem I'm having.

What I'm trying to do is link to YouTube videos (more than one in a single
webpage).  However, because I'm worried about the videos going away and the
links going bad, I'd like to use PHP to check if the link is good; if it's
good, display the video link, else display a static image that I have on my
servers.

Where I'm having troubles is in the checking of whether the url is good.  I
think part of the problem is YouTube itself.  I've tried file() and
fsockopen(), but neither seem to work.

Below is an example of the block of code I'm trying to write.

http://www.youtube.com/v/JqO8ZevPJNk"; url is valid) <-- ???
   {
 echo "  \n";
 echo "  http://www.youtube.com/v/JqO8ZevPJNk\";>\n";
 echo "  http://www.youtube.com/v/JqO8ZevPJNk\"\n";;
 echo " type=\"application/x-shockwave-flash\" height=\"400\" 
width=\"475\">\n";
 echo "  \n";
   }
   else
   {
 echo "  \n";
   }
?>

Many thanks for any assistance you can provide.

Robert Porter

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



Re: [PHP] Encoding issue with ?

2007-01-24 Thread Dave Goodchild

Thanks guys. The issue is that users can specify text as well as currency in
the input field ie '£2 students / £5 general admission'.


Re: [PHP] Encoding issue with ?

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-24 16:58:51 +0100:
> currency values should be stored in the DB as integers (i.e. as penny
> based values).  no floats (so that you avoid any rounding errors) and
> definitely no currency symbols!
 
What about DECIMAL?

> if you need to store which currency the price/ammount is in then use
> a seperate field

Or use a smart database, see e. g.
http://archives.postgresql.org/pgsql-general/2005-08/msg01432.php

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Encoding issue with £

2007-01-24 Thread Jochem Maas
Dave Goodchild wrote:
> This may be more of a mysql issue, but I am using php for my app so here
> goes...
> 
> I have a fee field in the database, and when users post events they can
> specify entrance fee in £. In some, not all, of the fields I am getting,
> for
> example, £7 rather than £. Is this an encoding issue?
> 
> Many thanks in advance...
> 

as a sidenote (won't help to fix the current encoding issues outright):

currency values should be stored in the DB as integers (i.e. as penny based 
values).
no floats (so that you avoid any rounding errors) and definitely no currency 
symbols!

(if you need to store which currency the
price/ammount is in then use a seperate field (and don't use the symbol, 
instead use the currency
ISO code - many currencies share a common symbol!)

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



Re: [PHP] Unserialize problem (and or bug)

2007-01-24 Thread Jochem Maas
Németh Zoltán wrote:
> On sze, 2007-01-24 at 17:17 +0200, Sancar Saran wrote:
>> Hi,
>>
>> After updating company test server to dotdeb 5.2.0 it star to give memory 
>> problems (even 32mb session). I tought it was because of suhosin. And I 
>> cannot update that server to vanilla debian php5 package because it was a 
>> sarge so today my company gives me another debian etch (like my home pc). I 
>> setup latest php 5.2.0.8 for debian etch.

this is too vague to say anything about. what memory problems???

>>
> 
> sorry for my ignorance but what is the difference between "vanilla php5"
> and php5?

normally php5 is strawberry flavour ;-)

> 
> thanks
> Zoltán Németh
> 
>> Then unserialize gives another problem 
>>
>> Message: unserialize(): Error at offset 1384 of 3177 bytes
>> Code: 8
>> Line: 419

are you unserializing data that was serialized with an older version
of php per chance? the data format may have changed - I read something
about that but can't remember if it's applicable to 5.2.x

write a test script that serializes and unserializes data to
see if that also shows the problem.

>>
>> My pc uses debian etch and have php 5.1.6-5 my scripts working normally.
>>
>> Is there any suggestion for handle this ? 
>>
>> Regards
>>
>> Sancar
>>
> 

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



Re: [PHP] Unserialize problem (and or bug)

2007-01-24 Thread Sancar Saran
Hi,
I mean there was no offical php5 package for debian sarge. Dotdeb was not 
offical.

On Wednesday 24 January 2007 17:46, Németh Zoltán wrote:
> On sze, 2007-01-24 at 17:17 +0200, Sancar Saran wrote:
> > Hi,
> >
> > After updating company test server to dotdeb 5.2.0 it star to give memory
> > problems (even 32mb session). I tought it was because of suhosin. And I
> > cannot update that server to vanilla debian php5 package because it was a
> > sarge so today my company gives me another debian etch (like my home pc).
> > I setup latest php 5.2.0.8 for debian etch.
>
> sorry for my ignorance but what is the difference between "vanilla php5"
> and php5?
>
> thanks
> Zoltán Németh
>
> > Then unserialize gives another problem
> >
> > Message: unserialize(): Error at offset 1384 of 3177 bytes
> > Code: 8
> > Line: 419
> >
> > My pc uses debian etch and have php 5.1.6-5 my scripts working normally.
> >
> > Is there any suggestion for handle this ?
> >
> > Regards
> >
> > Sancar

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



Re: [PHP] Unserialize problem (and or bug)

2007-01-24 Thread Németh Zoltán
On sze, 2007-01-24 at 17:17 +0200, Sancar Saran wrote:
> Hi,
> 
> After updating company test server to dotdeb 5.2.0 it star to give memory 
> problems (even 32mb session). I tought it was because of suhosin. And I 
> cannot update that server to vanilla debian php5 package because it was a 
> sarge so today my company gives me another debian etch (like my home pc). I 
> setup latest php 5.2.0.8 for debian etch.
> 

sorry for my ignorance but what is the difference between "vanilla php5"
and php5?

thanks
Zoltán Németh

> Then unserialize gives another problem 
> 
> Message: unserialize(): Error at offset 1384 of 3177 bytes
> Code: 8
> Line: 419
> 
> My pc uses debian etch and have php 5.1.6-5 my scripts working normally.
> 
> Is there any suggestion for handle this ? 
> 
> Regards
> 
> Sancar
> 

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



[PHP] Unserialize problem (and or bug)

2007-01-24 Thread Sancar Saran
Hi,

After updating company test server to dotdeb 5.2.0 it star to give memory 
problems (even 32mb session). I tought it was because of suhosin. And I 
cannot update that server to vanilla debian php5 package because it was a 
sarge so today my company gives me another debian etch (like my home pc). I 
setup latest php 5.2.0.8 for debian etch.

Then unserialize gives another problem 

Message: unserialize(): Error at offset 1384 of 3177 bytes
Code: 8
Line: 419

My pc uses debian etch and have php 5.1.6-5 my scripts working normally.

Is there any suggestion for handle this ? 

Regards

Sancar

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-24 10:44:21 -0400:
> Rather than a wide monitor, I'd like to have a tall one - say 21" square.

Wide screens are nice, you can have more 80-char terminals next to each
other.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Jon Anderson

Miles Thompson wrote:
More seriously, many times I've taken a "It's right, but not working, 
dammit!" SQL statement,
broken it up so it's listed "vertically" and discovered the error. 

Just my 2 cents worth...

SQL actually does lend itself rather well to normal code style 
indenting, even though not many seem to do it...Breaking it (and PHP 
code of course) into 78/80-char lines makes great sense for readability 
within PHP code:


$sql = "
   SELECT
   (list of fields),
   CASE ... END AS field
   ...
   FROM (table)
   JOIN (table) USING(column)
   JOIN (table) ON(column=column)
   ...
   WHERE
   (condition)
   AND
   (
  (sub-condition)
   OR
  (sub-condition)
   )
   GROUP BY (column)
   ...
";

These things are a real pain to read without formatting! :-)

I think writing unformatted SQL queries is like writing code like "if 
($var) { statement; statement; statement; foreach ($var as $v) { 
statement; statement; statement; } statement; etc. }"


jon

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Miles Thompson

At 09:41 AM 1/24/2007, Roman Neuhauser wrote:


# [EMAIL PROTECTED] / 2007-01-24 13:57:03 +0200:
> and also in these days I'm looking for 19 inch (or more) wide LCD
> sceerns to able to fit longer lines in my screen...

Number of reading errors people make grows with line length,
this has been known for as long as I remember.  You're increasing the
probability of bugs in the code, and get tired sooner because following
long lines requires more energy.


Good point Roman. Just think how that would cut down traffic on the list!
The "most powerful editor" should have a setting MAX_WORDS_PER_LINE = 11. 

More seriously, many times I've taken a "It's right, but not working, 
dammit!" SQL statement,

broken it up so it's listed "vertically" and discovered the error.

Rather than a wide monitor, I'd like to have a tall one - say 21" square.

How did we ever live with 12" terminal windows - huge to KayPro folk.

Cheers - Miles



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.410 / Virus Database: 268.17.8/649 - Release Date: 1/23/2007



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



[PHP] HTML Input - Auto Format URL's

2007-01-24 Thread Chris
Hi,

I'm currently looking into the best way to approach this.

Users will be allowed to enter HTML, but I want to add the ability to 
automatically format URL's and e-mail addresses.
The problem here is before formatting URL's we need to ignore URL's that are 
already used in HTML tags and that are already formatted as hyperlinks.

First I am thinking if its possible to achieve this with various regular 
expression patterns.
Another is to do a first pass of the input and find out what to ignore, then 
on a second pass with format the links that were determined to be formatted.

I am welcome to any suggestions about this.

Thanks. 

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



RE: [PHP] Re: PHP IMAP with Attachments!?

2007-01-24 Thread Edward Kay
> >Hello,
> >
> >on 10/31/2006 01:36 PM Andy said the following:
> >
> >
> >>I need a class that reads emails from a server and reads the
> >>
> >>
> >attachments from the mail.
> >
> >
> >>The mailservers is an IMAP for mail reading.
> >>
> >>The attachment types can be: images/pdf/text documents.
> >>
> >>Any suggestions?
> >>
> >>On phpclasses.org did not find any which works well.
> >>
> >>
> >
> >I think the PHP IMAP extension can do all you need, if you have it
> >installed. Otherwise, you can just use pure PHP IMAP client class and
> >the use this MIME message parser to extract the message body parts into
> >a string or a separate file:
> >
> >http://www.phpclasses.org/mimeparser
> >
> >This gets the messages without using the PHP IMAP extension:
> >
> >http://www.phpclasses.org/imap
> >
> >
> >
> >
> Im facing a simliar problem  Im using the mimeparser and the pop3class
> and can see the attachment name but im not sure how to access it and
> save it to a directory of my choice. So far I see the results of the
> array generated after the message has been coded but still not sure how
> to access the attachement. The output is as follows:
>

I had to solve a similar problem recently and used customised version of
this:

http://uk.php.net/manual/en/function.imap-fetchstructure.php#51497

Edward

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



Re: [PHP] Re: PHP IMAP with Attachments!?

2007-01-24 Thread Angelo Zanetti



Manuel Lemos wrote:


Hello,

on 10/31/2006 01:36 PM Andy said the following:
 


I need a class that reads emails from a server and reads the
   


attachments from the mail.
 


The mailservers is an IMAP for mail reading.

The attachment types can be: images/pdf/text documents.

Any suggestions?

On phpclasses.org did not find any which works well.
   



I think the PHP IMAP extension can do all you need, if you have it
installed. Otherwise, you can just use pure PHP IMAP client class and
the use this MIME message parser to extract the message body parts into
a string or a separate file:

http://www.phpclasses.org/mimeparser

This gets the messages without using the PHP IMAP extension:

http://www.phpclasses.org/imap


 

Im facing a simliar problem  Im using the mimeparser and the pop3class 
and can see the attachment name but im not sure how to access it and 
save it to a directory of my choice. So far I see the results of the 
array generated after the message has been coded but still not sure how 
to access the attachement. The output is as follows:


Array ( [Headers] => Array ( [return-path:] => [to:] => Manuel Lemos 
[subject:] => Testing Manuel Lemos' MIME E-mail composing and sending 
PHP class: HTML message [from:] => mlemos [reply-to:] => mlemos 
[sender:] => [EMAIL PROTECTED] [x-mailer:] => 
http://www.phpclasses.org/mimemessage $Revision: 1.63 $ (mail) 
[mime-version:] => 1.0 [content-type:] => multipart/mixed; 
boundary="652b8c4dcb00cdcdda1e16af36781caf" [message-id:] => 
<[EMAIL PROTECTED]> [date:] => Sat, 30 Apr 2005 
19:28:29 -0300 ) [Parts] => Array ( [0] => Array ( [Headers] => Array ( 
[content-type:] => multipart/related; 
boundary="6a82fb459dcaacd40ab3404529e808dc" ) [Parts] => Array ( [0] => 
Array ( [Headers] => Array ( [content-type:] => multipart/alternative; 
boundary="69c1683a3ee16ef7cf16edd700694a2f" ) [Parts] => Array ( [0] => 
Array ( [Headers] => Array ( [content-type:] => text/plain; 
charset=ISO-8859-1 [content-transfer-encoding:] => quoted-printable ) 
[Parts] => Array ( ) [BodyPart] => 1 [BodyLength] => 91 ) [1] => Array ( 
[Headers] => Array ( [content-type:] => text/html; charset=ISO-8859-1 
[content-transfer-encoding:] => quoted-printable ) [Parts] => Array ( ) 
[BodyPart] => 2 [BodyLength] => 961 ) ) ) [1] => Array ( [Headers] => 
Array ( [content-type:] => image/gif; name="logo.gif" 
[content-transfer-encoding:] => base64 [content-disposition:] => inline; 
filename="logo.gif" [content-id:] => ) [Parts] => Array ( ) [BodyPart] 
=> 3 [BodyLength] => 1195 ) [2] => Array ( [Headers] => Array ( 
[content-type:] => image/gif; name="background.gif" 
[content-transfer-encoding:] => base64 [content-disposition:] => inline; 
filename="background.gif" [content-id:] => 
<4c837ed463ad29c820668e835a270e8a.gif> ) [Parts] => Array ( ) [BodyPart] 
=> 4 [BodyLength] => 3265 ) ) ) [1] => Array ( [Headers] => Array ( 
[content-type:] => text/plain; name="attachment.txt" 
[content-transfer-encoding:] => base64 [content-disposition:] => 
attachment; filename="attachment.txt" ) [Parts] => Array ( ) [BodyPart] 
=> 5 [BodyLength] => 64 ) ) )


Its pretty confusing and not too sure where to start. any assistance 
would be greatly appreciated.


kind regards

--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Robert Cummings
On Wed, 2007-01-24 at 13:41 +, Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-24 13:57:03 +0200:
> > and also in these days I'm looking for 19 inch (or more) wide LCD
> > sceerns to able to fit longer lines in my screen...
> 
> Number of reading errors people make grows with line length,
> this has been known for as long as I remember.  You're increasing the
> probability of bugs in the code, and get tired sooner because following
> long lines requires more energy.

Yep long lines are hard to read and formatting lines can improve
information absorption by providing extra visual cues. I use a 20" LCD
monitor and still format to 78 character wide lines.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-24 13:57:03 +0200:
> and also in these days I'm looking for 19 inch (or more) wide LCD
> sceerns to able to fit longer lines in my screen...

Number of reading errors people make grows with line length,
this has been known for as long as I remember.  You're increasing the
probability of bugs in the code, and get tired sooner because following
long lines requires more energy.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Sancar Saran
I believe this was related to what did you want to do with your editor. 

I use these editors

Linux - KDE -> Kate
Win32 -> Ultra Edit

Both are support UTF8 and both can handle more than one file at one session.. 
Enough search and replace abilites.  Both can highlight code...

I wish to KDE (and or Kate) can support key macros to support my G15 extra 
buttons for speeding up some HTML and PHP standart code blocks...

I use pico and nano for editing php code very long time ago. (multiple shell 
windows etc).

Then I realize, abilites of editor effect my coding style. At that days, I 
star to add line brake to SQL querys line because of long sql querys does not 
fit the screen.

And also I detect when you adjust yourself to high capacity editor, you may be 
very frusturated and feel uncomfortable with that low capacity ones...

and also in these days I'm looking for 19 inch (or more) wide LCD sceerns to 
able to fit longer lines in my screen...

Regards

Sancar

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



Re: [PHP] OT - Leaving

2007-01-24 Thread Jochem Maas
with all the respect that should be afforded to someone
so bloody helpful:

thank you for all the fish :-)

best wishes,
Jochem

John Nichel wrote:
> Howdy ladies and gents:
> 
>   For the past 9 or so years, with one email account or another, I have
> been subscribed to the PHP General Mailing List.  Well, life an work
> have succeeded in taking up all of my time, and the only thing I've been
> able to do with this list over the past year or so is select all the
> unread messages in my php folder, and hit the delete key.  If I've
> posted 10 messages over the past year, I'd be surprised (probably why
> you n00bs are saying to yourself, "who the hell is this guy").  I'm just
> popping in now to let y'all know that I'm off to join people like John
> and Jason in the world of, "what ever happened to him".  For those of
> you who give a damn ;)  I can be reached at numerous email addresses,
> including:
> 
> john  nichel  net
> jnichel  by-tor  com
> 
> As well as the other in this email (which have already been harvested by
> a billion spam bots).
> 
> Have fun, and I'll see ya on the other side.
> 

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



Re: [PHP] most powerful php editor

2007-01-24 Thread Robert Cummings
On Wed, 2007-01-24 at 10:31 +, Robin Vickery wrote:
> On 21/01/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:
> > -Original Message-
> > From: Vinicius C Silva [mailto:[EMAIL PROTECTED]
> > Sent: 21 January 2007 02:54
> > To: php-general@lists.php.net
> > Subject: [PHP] most powerful php editor
> >
> > For me the analogy goes something like this: if you type the occasional
> > letter or note then Wordpad is perfectly adequate, but if your livelihood is
> > churning out professional well-formatted heavy-weight documents then it pays
> > you to invest in a top-class word processor and supporting tools.
> 
> Or alternatively, use vim and LaTeX and produce documents of a
> consistently higher quality than practically any top-class word
> processor.

The inherent problem in any top-class word processor being used to
produce PHP code is that PHP will quite likely (read WILL) choke on the
binary format. And if it's not saved in a binary format, then it's
probable you've lost all that "top-class" formatting :B

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] OT - Leaving

2007-01-24 Thread Ryan A


FYI, for the noobs, the John and Jason referenced in the email are John
Holmes and Jason Wong.


Yep, two of the "big" guys without who... many would have taken a muchh longer 
path to learning php, including me.

I dont know if theres a "list heroes" list, but if there is... John is def mine.
Although if you put  "John Holmes" into google... you'll see a lot of other 
work he has done on film a long time ago :))

Cheers!
R


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
-
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.

Re: [PHP] OT - Leaving

2007-01-24 Thread Ryan A
Who the f*/k are you? and why should we remember you

Hehe just kidding, you may have not posted a lot in the last year but you have 
helped me many times before thatwhich I really appreciate.

Thanks for your help mate, and I hope you have success in whatever you decide 
to do.

Cheers!
R

John Nichel <[EMAIL PROTECTED]> wrote: Howdy ladies and gents:

   For the past 9 or so years, with one email account or another, I have 
been subscribed to the PHP General Mailing List.  Well, life an work 
have succeeded in taking up all of my time, and the only thing I've been 
able to do with this list over the past year or so is select all the 
unread messages in my php folder, and hit the delete key.  If I've 
posted 10 messages over the past year, I'd be surprised (probably why 
you n00bs are saying to yourself, "who the hell is this guy").  I'm just 
popping in now to let y'all know that I'm off to join people like John 
and Jason in the world of, "what ever happened to him".  For those of 
you who give a damn ;)  I can be reached at numerous email addresses, 
including:

john  nichel  net
jnichel  by-tor  com

As well as the other in this email (which have already been harvested by 
a billion spam bots).

Have fun, and I'll see ya on the other side.

-- 
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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




--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
-
8:00? 8:25? 8:40?  Find a flick in no time
 with theYahoo! Search movie showtime shortcut.

Re: [PHP] most powerful php editor

2007-01-24 Thread Robin Vickery

On 21/01/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:

-Original Message-
From: Vinicius C Silva [mailto:[EMAIL PROTECTED]
Sent: 21 January 2007 02:54
To: php-general@lists.php.net
Subject: [PHP] most powerful php editor

For me the analogy goes something like this: if you type the occasional
letter or note then Wordpad is perfectly adequate, but if your livelihood is
churning out professional well-formatted heavy-weight documents then it pays
you to invest in a top-class word processor and supporting tools.


Or alternatively, use vim and LaTeX and produce documents of a
consistently higher quality than practically any top-class word
processor.

-robin

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



RE: [PHP] where match question

2007-01-24 Thread Németh Zoltán
On k, 2007-01-23 at 22:49 -0700, Don wrote:
> On k, 2007-01-23 at 00:58 -0800, Jim Lucas wrote:
> > Németh Zoltán wrote:
> > > On k, 2007-01-23 at 19:46 +1100, chris smith wrote:
> > >> On 1/23/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
> > >>> On h, 2007-01-22 at 22:53 -0800, Jim Lucas wrote:
> >  Don wrote:
> > > I have a db field that contains zip codes separated by comas.
> > >
> > > I am trying to get php to return all of the rows that contain a
> particular
> > > zip code.
> > >
> > >
> > >
> > > $query = "SELECT * FROM info WHERE MATCH (partialZIP) AGAINST
> ('$zip')";
> >  try this
> > 
> >  $query = "SELECT * FROM info WHERE column LIKE '{$zip}'";
> > >>> I would use
> > >>>
> > >>> $query = "SELECT * FROM info WHERE LOCATE('{$zip}', column) > 0";
> > >> And how are you going to index that? That's going to be extremely slow
> > >> as the size of the table grows.
> > >>
> > > 
> > > well, yes.
> > > 
> > > better solution is to not store the zip codes in one field with commas,
> > > but in a separate table which relates to this one. and then you could
> > > use a query like
> > > 
> > > $query = "SELECT t1.*, t2.* FROM info t1, zips t2 WHERE t1.id=t2.infoid
> > > AND t2.zip = '{$zip}'";
> > > 
> > > greets
> > > Zoltán Németh
> > > 
> > But, since the op is working with existing data, what is the performance 
> > difference between using LIKE or LOCATE?
> > 
> > Pro's vs. Con's
> > 
> > 
> > 
> 
> oops I just made a simple performance test and the result showed me that
> LIKE is faster (in my test it was twice as faster than LOCATE)
> 
> sorry for my ignorance, I did not know that
> 
> greets
> Zoltán Németh
> 
> I appreciate all the input. I would definitely like to use a separate table
> for the zips, but I cannot figure out how make the form that stores them
> user friendly each entry can have any number of zips - from many to just
> a few.
> 
> Also, the site is in development, so there is no existing data 
> 
> I will play with LIKE for the time being.

well if you don't have existing data I strongly recommend putting the
zips into a separate table (and then you can forget LIKE and LOCATE as
well ;) )

you don't have to change the user input part, the user may enter all the
zips separated with commas, you only have to do an explode() on it and
then store the resulting array into the zips table.

http://www.php.net/manual/en/function.explode.php

greets
Zoltán Németh

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



Re: [PHP] Encoding issue with £

2007-01-24 Thread Frank Arensmeier

23 jan 2007 kl. 18.55 skrev Dave Goodchild:

This may be more of a mysql issue, but I am using php for my app so  
here

goes...

I have a fee field in the database, and when users post events they  
can
specify entrance fee in £. In some, not all, of the fields I am  
getting, for

example, £7 rather than £. Is this an encoding issue?

Many thanks in advance...

--
http://www.web-buddha.co.uk

Dave,

Maybe you already noticed that the first two letters of "£7" are the  
UTF8 encoded pound sign. But where the 7 is coming from, I do not  
know. Does the data come from a html form? A select list? Do you have  
a valid html encoding specified for your html code? I would begin by  
looking at the source where the data is coming from. In order to  
track the bug, maybe (temporarily) you could have a db where you  
would strore a var_dump on posted data together with a var_dump on  
$_SERVER. It might be possible as well to get some information about  
the users curent browser encoding by using some java script? This  
information might give you some help in narrowing down the source of  
your problem.


Otherwise, why not give your user predefined currencies to choose  
from? A simple select list would do the trick.


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