Re: [PHP] odd behavior of stripos() with === operator

2006-11-16 Thread Michael
At 12:29 AM 11/17/2006 , you wrote: >> I have underlined the output I am interested in... > >You did??? Where? > Ok, my bad, I sent the mail as plain text instead of styled :P oops >> How can the variable $found be both TRUE and FALSE at the same time? > >None of your output above indicates that

Re: [PHP] odd behavior of stripos() with === operator

2006-11-16 Thread Robert Cummings
On Fri, 2006-11-17 at 00:24 -0700, Michael wrote: > HEllo all, > > After pulling my hair out for several hours trying to figure out why my code > wasn't working I built this little test and ran it, the results are > interesting > in the least, and to me, surprising. It is possible that I have don

Re: [PHP] Re: Space in regex

2006-11-16 Thread Paul Novitski
At 11/16/2006 03:19 PM, Dotan Cohen wrote: However, this function: $text=preg_replace_callback('/\[([A-Za-z0-9\|\'.-:underscore:]+)\]/i' , "findLinks", $text); Does what I want it to when there is no space, regardless of whether or not there is a pipe. It does not replace anything if there is a s

[PHP] odd behavior of stripos() with === operator

2006-11-16 Thread Michael
HEllo all, After pulling my hair out for several hours trying to figure out why my code wasn't working I built this little test and ran it, the results are interesting in the least, and to me, surprising. It is possible that I have done something wrong, but I checked and rechecked this in the docu

Re: [PHP] Re: Space in regex

2006-11-16 Thread Dotan Cohen
On 17/11/06, Paul Novitski <[EMAIL PROTECTED]> wrote: At 11/16/2006 08:46 PM, Myron Turner wrote: >The underscore plus alphanumeric are included in \w, so to get a >regex such as you want: > [\w\s\.\-&\']+ >You should escape the dot because the unescaped dot stands for any >single

Re: [PHP] Dynamic Year Drop Down

2006-11-16 Thread Albert Padley
Thanks, Larry. This was close, but didn't quite work. I played around with the syntax and the following worked great. $this_year = date('Y'); echo "\n"; for ($i= $this_year-1; $i < $this_year+3; ++$i) { echo "" . $i . "\n"; } echo "\n"; Al Padley On Nov 16, 2006, at 11:32 PM, L

Re: [PHP] Dynamic Year Drop Down

2006-11-16 Thread Albert Padley
On Nov 16, 2006, at 11:04 PM, Tom Ray [Lists] wrote: Albert Padley wrote: I want to build a select drop down that includes last year, the current year and 3 years into the future. Obviously, I could easily hard code this or use a combination of the date and mktime functions to populate

Re: [PHP] Dynamic Year Drop Down

2006-11-16 Thread Larry Garfield
Quite simple: $this_year = date('Y'); for ($i= $this_year-1; $i < $this_year+3; ++$i) { print "$i\n"; } Obviously modify for however you're doing output. (Note that you DO want to have the redundant value attribute in there, otherwise some Javascript things don't work right in IE. Good habi

[PHP] Dynamic Year Drop Down

2006-11-16 Thread Albert Padley
I want to build a select drop down that includes last year, the current year and 3 years into the future. Obviously, I could easily hard code this or use a combination of the date and mktime functions to populate the select. However, I'm looking for a more elegant way of doing this. Thank

Re: [PHP] Re: Space in regex

2006-11-16 Thread Paul Novitski
At 11/16/2006 08:46 PM, Myron Turner wrote: The underscore plus alphanumeric are included in \w, so to get a regex such as you want: [\w\s\.\-&\']+ You should escape the dot because the unescaped dot stands for any single character, which is why .* stands for any and all charact

[PHP] Re: Space in regex

2006-11-16 Thread Myron Turner
The \w regex includes all alphanumeric characters plus the underscore, i.e. all valid characters that make up a C identifier. So what you want can be expressed as follows: [\w\s\.\-&]+ You have to escape the dot because in a regular espression it represents any single character, which is

[PHP] Re: Space in regex

2006-11-16 Thread Myron Turner
The underscore plus alphanumeric are included in \w, so to get a regex such as you want: [\w\s\.\-&\']+ You should escape the dot because the unescaped dot stands for any single character, which is why .* stands for any and all characters. Dotan Cohen wrote: I'm trying to matc

Re: [PHP] Splitting a string

2006-11-16 Thread Paul Novitski
On Thursday 16 November 2006 01:38, Paul Novitski wrote: > If you need to left-pad with zeroes, PHP comes to the rescue: > http://php.net/str_pad > > However, if you're using the regular expression > method then you might not need to pad the > number. You can change the pattern from this: > >

Re: [PHP] Splitting a string

2006-11-16 Thread Børge Holen
On Thursday 16 November 2006 01:38, Paul Novitski wrote: > At 11/15/2006 02:06 PM, Børge Holen wrote: > >Oh this was good. > >I added a while loop to insert extra strings "0" > >in front of the number to add > >if the string is less than 5 chars short. > > > >I forgot to mentinon that the string ac

Re: [PHP] Splitting a string

2006-11-16 Thread Børge Holen
On Thursday 16 November 2006 01:12, Robert Cummings wrote: > On Thu, 2006-11-16 at 10:47 +1100, Chris wrote: > > Børge Holen wrote: > > > Oh this was good. > > > I added a while loop to insert extra strings "0" in front of the number > > > to add if the string is less than 5 chars short. > > > > sp

Re: [PHP] Re: Space in regex

2006-11-16 Thread Dotan Cohen
On 17/11/06, Paul Novitski <[EMAIL PROTECTED]> wrote: Dotan, I'm surmising what you really want to do is grab all the characters between [ and | for the first field, and everything from | to ] as the second field. I would therefore identify the first field with: [^\]|] anythi

Re: [PHP] Excel problem

2006-11-16 Thread Sancar Saran
On Thursday 16 November 2006 21:25, amit hetawal wrote: > Hello all, > Am pretty new to the world of PHP. And am now stuck. > Its like i am displayin the data from a database on to my webpage in > the form of tables. > but now i also want an option for the user to download the above data > into an

Re: [PHP] Re: Space in regex

2006-11-16 Thread Paul Novitski
At 11/16/2006 01:56 PM, Dotan Cohen wrote: $text=preg_replace_callback('/\[([A-Za-z0-9\'.-:underscore:]+)\|([A-Za-z0-9\'. -:underscore:]+)\]/i' , "findLinks", $text); This regex should match any pair of square brackets, with two bits of text between them seperated by a pipe, like these: [Ety|wif

Re: [PHP] Re: Space in regex

2006-11-16 Thread Jon Anderson
Dotan Cohen wrote: I should add more information. This is the entire regex: $text=preg_replace_callback('/\[([A-Za-z0-9\'.-:underscore:]+)\|([A-Za-z0-9\'. -:underscore:]+)\]/i' , "findLinks", $text); This regex should match any pair of square brackets, with two bits of text between them seper

Re: [PHP] Re: Space in regex

2006-11-16 Thread Dave Goodchild
I ran this expression through Regex Coach: \[([A-Za-z0-9\'.-:underscore:\s]+)\|([A-Za-z0-9\'. -:underscore:]+)\] ...and it matched the patterns your describe.

Re: [PHP] Looping through array

2006-11-16 Thread Paul Novitski
At 11/16/2006 12:19 PM, Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1, re

[PHP] Re: Space in regex

2006-11-16 Thread Dotan Cohen
On 16/11/06, Dotan Cohen <[EMAIL PROTECTED]> wrote: I'm trying to match alphanumeric characters, some common symbols, and spaces. Why does this NOT match strings containing spaces?: [A-Za-z0-9\'.&-:underscore::space:] I've also tried these, that also fail to match strings containing spaces: [A-Z

Re: [PHP] Looping through array

2006-11-16 Thread tedd
At 1:19 PM -0700 11/16/06, Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1,

Re: [PHP] Looping through array

2006-11-16 Thread Ashley M. Kirchner
Darrell Brogdon wrote: So in other words, you have an array like $arr = array(1,2,3,4,5,6,7,8,9,10) but you want it to render on the page as: 5 4 3 2 1 10 9 8 7 6 right? That would be correct. James Tu provided a solution that I think will work. I'm always open to other suggestions of

[PHP] Space in regex

2006-11-16 Thread Dotan Cohen
I'm trying to match alphanumeric characters, some common symbols, and spaces. Why does this NOT match strings containing spaces?: [A-Za-z0-9\'.&-:underscore::space:] I've also tried these, that also fail to match strings containing spaces: [A-Za-z0-9\'.&- :underscore:] [A-Z a-z0-9\'.&-:underscore

Re: [PHP] Looping through array

2006-11-16 Thread Darrell Brogdon
So in other words, you have an array like $arr = array (1,2,3,4,5,6,7,8,9,10) but you want it to render on the page as: 5 4 3 2 1 10 9 8 7 6 right? -D On Nov 16, 2006, at 1:35 PM, Ashley M. Kirchner wrote: Darrell Brogdon wrote: $arr = array(5, 4, 3, 2, 1, 10, 9, 8, 7, 6,); The

Re: [PHP] Looping through array

2006-11-16 Thread James Tu
$arr = array(...); $first_row = ''; $second_row = ''; for ($i=4; $i>=0; $i--){ $first_row = $first_row . "{$arr[$x]}"; $second_row = $second_row . "{$arr[$x + 5]}"; } print '' . $first_row . '/'; print '' . $second_row . '/'; On Nov 16, 2006, at 3:19 PM, Ashley M. Kirchner wrote

Re: [PHP] Looping through array

2006-11-16 Thread Dave Goodchild
If you know the array elements, you may not need to loop. Why not just echo the particular array elements i.e. for example?

Re: [PHP] Looping through array

2006-11-16 Thread Ashley M. Kirchner
Brad Bonkoski wrote: Something like this perhaps... $arr = array(...); $per_row = 5; $elem = count($arr); for($i=0; $i<$elem; $i++) { if( $i == 0 ) echo ""; else if( $i % $per_row == 0 ) echo ""; echo "$arr[$i]"; } That simply displays things in order, 1 through 5, then

Re: [PHP] Looping through array

2006-11-16 Thread Darrell Brogdon
'; echo ''; for ($x=0,$y=sizeof($arr); $x<$y; ++$x) { echo "{$arr[$x]}"; if ($x == 4) { echo ''; } } echo ''; echo ''; ?> On Nov 16, 2006, at 1:19 PM,

Re: [PHP] Looping through array

2006-11-16 Thread Brad Bonkoski
Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1, repeated twice, and the

Re: [PHP] Looping through array

2006-11-16 Thread Brad Bonkoski
Ashley M. Kirchner wrote: Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1, repeated twice, and the

[PHP] Looping through array

2006-11-16 Thread Ashley M. Kirchner
Say I have an array containing ten items, and I want to display them in a table as follows: 5 4 3 2 1 10 9 8 7 6 What's the best way to loop through that array to do that? My thinking gets me to create a loop for 5 through 1, repeated twice, and the second time I add '5' to th

Re: [PHP] Smart Quotes not so smart

2006-11-16 Thread Chris Shiflett
Larry Garfield wrote: > I've run into this sort of issue a few times before, and never > found a good solution. Not sure if this is the solution you're looking for, but you can convert them to regular quotes: http://shiflett.org/archive/165 Hope that helps. Chris -- Chris Shiflett http://shif

Re: [PHP] Excel problem

2006-11-16 Thread amit hetawal
hello, Yes i have gone through the documentation. bu ti can find a way to link the download excel thing with the link which says donwload in excel. Is it that i have to fetch the data 2 times , one for displayin it in table and the other time downloadin in excel Any suggestions Thanks On 11/16/

RE: [PHP] Excel problem

2006-11-16 Thread Brad Fuller
You could also name the file *.csv and use a comma as a delimiter instead. Don't forget to put quotes around any data that may have tab characters in it. (Or commas if you're using csv) Hope that helps -B > -Original Message- > From: amit hetawal [mailto:[EMAIL PROTECTED] > Sent: Th

RE: [PHP] Excel problem

2006-11-16 Thread Jay Blanchard
[snip] please advice. [/snip] Have you read the documentation? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Excel problem

2006-11-16 Thread amit hetawal
Hello all, Am pretty new to the world of PHP. And am now stuck. Its like i am displayin the data from a database on to my webpage in the form of tables. but now i also want an option for the user to download the above data into an excel format for the offline use. I dont want to create the excel f

[PHP] Re: [RESOLVED] PHP 5.2.0 Session Handling Bug? Can someone test this please?

2006-11-16 Thread Colin Guthrie
Jürgen Wind wrote: > as you mentioned using hardened php: > maybe you have to adjust hphp.post.max_value_length = > and/or some other settings Thanks to Mr Oden Eriksson @ Mandriva, he pointed out that I needed to up the value for "suhosin.request.max_vars" from the default of 200. So you were

Re: [PHP] PHP 5.2.0 Session Handling Bug? Can someone test this please?

2006-11-16 Thread Jürgen Wind
Colin Guthrie-6 wrote: > > Hi, > > I've noticed a bug with PHP 5.2.0 when dealing with sessions and posting > quite large forms. > > I've attached a file that highlights the bug. > > Can people test this please and if it is confirmed i'll post upsteam. > Just want to rule out my distro's pac

[PHP] Re: PHP 5.2.0 Session Handling Bug? Can someone test this please?

2006-11-16 Thread Colin Guthrie
Edward Kay wrote: > Have you checked your error_log? I've had this problem when the wrong > permissions were set on /var/lib/php/session which meant PHP couldn't write > it's session files and hence generated a new ID each time. The error_log > will tell you if this is the case. No, but the proble

[PHP] Re: PHP 5.2.0 Session Handling Bug? Can someone test this please?

2006-11-16 Thread Colin Guthrie
Frank J. Schima wrote: > The ID never changed for me. > > PHP 5.2.0 > Apache 1.3.33 > Mac OS X 10.4.8 Cheers mate. I guess that could mean its: * Apache 2 thing * x86_64 thing * suhosin thing * mandriva thing More tests to narrow those down would be appreciated if anyone has appropriate in

RE: [PHP] Re: PHP 5.2.0 Session Handling Bug? Can someone test this please?

2006-11-16 Thread Edward Kay
Have you checked your error_log? I've had this problem when the wrong permissions were set on /var/lib/php/session which meant PHP couldn't write it's session files and hence generated a new ID each time. The error_log will tell you if this is the case. Edward > Colin Guthrie wrote: > > Hi, > > >

Re: [PHP] PHP 5.2.0 Session Handling Bug? Can someone test this please?

2006-11-16 Thread Frank J. Schima
The ID never changed for me. PHP 5.2.0 Apache 1.3.33 Mac OS X 10.4.8 On Nov 16, 2006, at 9:28 AM, Colin Guthrie wrote: I've noticed a bug with PHP 5.2.0 when dealing with sessions and posting quite large forms. I've attached a file that highlights the bug. Can people test this please and

Re: [PHP] file_get_contents

2006-11-16 Thread Tom Chubb
Confused! I'm now getting: file_get_contents(http://www.tnhosting.co.uk/scripts/gclub/player.php) [function.file-get-contents]: failed to open stream: Connection refused in /home/sites/tnhosting.co.uk/public_html/scripts/gclub/updateplaylist.php on line 75 How come you can access it and I can't?!

[PHP] Re: PHP 5.2.0 Session Handling Bug? Can someone test this please?

2006-11-16 Thread Colin Guthrie
Colin Guthrie wrote: > Hi, > > I've noticed a bug with PHP 5.2.0 when dealing with sessions and posting > quite large forms. > > I've attached a file that highlights the bug. > > Can people test this please and if it is confirmed i'll post upsteam. > Just want to rule out my distro's packaging b

Re: [PHP] Sorting multidimensional arrays

2006-11-16 Thread Dave Goodchild
Result. Cheers! On 11/16/06, Robert Cummings <[EMAIL PROTECTED]> wrote: On Thu, 2006-11-16 at 15:28 +, Dave Goodchild wrote: > Hi all. I have a multidimensional array here: > > Bums" ["name"]=> string(13) "Tits And Bums" [3]=> string(19) "The Pleasure > > [--SNIP--] > > ...which comprises a

RE: [PHP] file_get_contents

2006-11-16 Thread Brad Fuller
Yes, I realize that now ;) I didn't read it thoroughly enough before I posted :P I think what Tom is referring to as "PHP code" is just the extra HTML tags around the object tag that he is trying to strip out. Tom - Try this: http://www.tnhosting.co.uk/scripts/gclub/player.php";); $nstart =

Re: [PHP] file_get_contents

2006-11-16 Thread Jochem Maas
Brad Fuller wrote: > Use curl or fopen() to make a request to that PHP page, instead of reading > in the actual contents of the file. heh Brad wtf do you think thw following line does??: $html = file_get_contents("http://www.tnhosting.co.uk/scripts/gclub/player.php";); > > Example: > >

Re: [PHP] file_get_contents

2006-11-16 Thread Jochem Maas
Tom Chubb wrote: > Thanks Jochem, > Tried that, but it's still showing php code in the text area! > Any other ideas? vanilla sky (go search for the tagline) ... if I request the following I get a page with a player into: http://www.tnhosting.co.uk/scripts/gclub/player.php if you do the

RE: [PHP] file_get_contents

2006-11-16 Thread Brad Fuller
Use curl or fopen() to make a request to that PHP page, instead of reading in the actual contents of the file. Example: http://blabla.com/player.php'; $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 120); c

Re: [PHP] file_get_contents

2006-11-16 Thread Tom Chubb
Thanks Jochem, Tried that, but it's still showing php code in the text area! Any other ideas? The url is http://www.tnhosting.co.uk/scripts/gclub/updateplaylist.php and you see it on submission. Feel free to post. It's a testing server. On 16/11/06, Jochem Maas <[EMAIL PROTECTED]> wrote: Tom

Re: [PHP] Sorting multidimensional arrays

2006-11-16 Thread Robert Cummings
On Thu, 2006-11-16 at 15:28 +, Dave Goodchild wrote: > Hi all. I have a multidimensional array here: > > Bums" ["name"]=> string(13) "Tits And Bums" [3]=> string(19) "The Pleasure > > [--SNIP--] > > ...which comprises a set of returned results for an events search - with the > date computed dy

[PHP] Sorting multidimensional arrays

2006-11-16 Thread Dave Goodchild
Hi all. I have a multidimensional array here: array(6) { [0]=> array(25) { [0]=> string(1) "7" ["eventid"]=> string(1) "7" [1]=> string(2) "17" ["cat_id"]=> string(2) "17" [2]=> string(13) "Tits And Bums" ["name"]=> string(13) "Tits And Bums" [3]=> string(19) "The Pleasure Centre" ["venue"]=> str

Re: [PHP] CSS / PHP / Javascript

2006-11-16 Thread Myron Turner
You can use a browser sniffer, where they've done all the work for you, and then link in the appropriate stylesheet using document.write(). I don't have personal experience with the IE conditionals, but I would be concerned that they'd get you into a bit of a box when it comes to recognizing o

[PHP] printing page functionality

2006-11-16 Thread Ulf Hyltmark
Hi, We are in need of a printing functionality for our webpage. The problem is that some of our pages has a greater width than a A4 paper so not all of the content will be printed when using the built in printer functionality in the browser. Is there any useful script out there that can take the

[PHP] ob_start() and a callback function within a class, not updating ob_get_level().

2006-11-16 Thread Mathijs
Hello there, I have a question about ob_start() and ob_get_level(). When i use ob_start(), and then check ob_get_level(), it shows me 1. This is a normal behavior. Now when i do the following ob_start(array('ClassName', 'ClassMethod')). It does execute the methode, but it doesn't update ob_get_

Re: [PHP] taking a one off payment

2006-11-16 Thread Google Kreme
On 16 Nov 2006, at 05:20 , Ross wrote: What is the best way to take a one off payent Paypal. (non-paypal) Well then, when you eliminate the obvious choice... I have used oscommece Speaking of oscommerce, has that package ever been fixed to run without register_globals? -- I don't wa

Re: [PHP] taking a one off payment

2006-11-16 Thread Jochem Maas
Ross wrote: > Hi, > > What is the best way to take a one off payent (non-paypal). cash in a stable currency ;-) > I have used > oscommece but never attempted a one payment like a subscription charge. > > > I would probalby be looking to use a trusted gateway like worldpay. > > > R. > -

[PHP] taking a one off payment

2006-11-16 Thread Ross
Hi, What is the best way to take a one off payent (non-paypal). I have used oscommece but never attempted a one payment like a subscription charge. I would probalby be looking to use a trusted gateway like worldpay. R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visi

Re: [PHP] file_get_contents

2006-11-16 Thread Jochem Maas
Tom Chubb wrote: > I am trying to read the contents of a "PHP" page for an audio player > and put it into a textarea to be copied and pasted into an "HTML" > page. > The trouble is the textarea shows unparsed PHP code and I just want the > HTML. > The code is: > > $player = file_get_contents('play

Re: [PHP] Smart Quotes not so smart

2006-11-16 Thread clive
Larry Garfield wrote: On our new devel setup (SQL Server 2k, OpenTDS ODBC driver, Apache, PHP 5.1.6), it works fine. On their new live setup, however, (same, but again not sure of the ODBC driver) they're getting the dreaded squares or question marks or accented characters that signify a ga

[PHP] file_get_contents

2006-11-16 Thread Tom Chubb
I am trying to read the contents of a "PHP" page for an audio player and put it into a textarea to be copied and pasted into an "HTML" page. The trouble is the textarea shows unparsed PHP code and I just want the HTML. The code is: $player = file_get_contents('player.php'); //Strip out unnecessa

Re: [PHP] cURL uses

2006-11-16 Thread clive
Dave Goodchild wrote: You would use cURL to achieve the things cURL is built to achieve? Wow that answer is not even worth the calories your burned type it. "Theres not such thing as stupid questions, only stupid answers" In your case this phrase holds some truth. -- PHP General Mailing List