Re: [PHP] Smart Quotes not so smart

2006-11-17 Thread Larry Garfield
On Thursday 16 November 2006 14:07, Chris Shiflett wrote: > 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.

RE: [PHP] extracting the file name from the referrer

2006-11-17 Thread John
R> you may want to look at the parse_url and explode functions. Thanks, I'll look into that R> you do realize that the referer, should it exist <...> Good point, thanks for pointing that out. Yes, I was aware of that it didn't come to mind. The security isn't so much an issue as that's already

[PHP] extracting the file name from the referrer

2006-11-17 Thread John
I need to extract just the filename from the referring url, stripping it of the path and any post vars on the end. there's got to be an easier way than this eh? $referrer = trim(strrchr(substr($_SERVER['HTTP_REFERER'],0, strpos($_SERVER['HTTP_REFERER'],"?")), "/"), "/") Thanks! -JP

RE: [PHP] Additional query for number of records in table

2006-11-17 Thread afan
> I've run into this before, and if you use MySQL you can do something > like this: > > SELECT SQL_CALC_FOUND_ROWS * FROM Products LIMIT $From, $To > > SELECT FOUND_ROWS() > > http://dev.mysql.com/doc/refman/5.0/en/information-functions.html > > The second query will give you the number of rows tha

RE: [PHP] Additional query for number of records in table

2006-11-17 Thread Ray Hauge
I've run into this before, and if you use MySQL you can do something like this: SELECT SQL_CALC_FOUND_ROWS * FROM Products LIMIT $From, $To SELECT FOUND_ROWS() http://dev.mysql.com/doc/refman/5.0/en/information-functions.html The second query will give you the number of rows that would have bee

Re: [PHP] Additional query for number of records in table

2006-11-17 Thread afan
> [EMAIL PROTECTED] wrote: >> hi, >> I have query to select products for specific category from DB, something >> like: >> SELECT prod_id, prod_name,... >> FROM products >> LIMIT $From, $To >> >> where $From and $To values depend of on what page you are. let say there >> are 100 products and I'm lis

Re: [PHP] Additional query for number of records in table

2006-11-17 Thread Brad Bonkoski
[EMAIL PROTECTED] wrote: hi, I have query to select products for specific category from DB, something like: SELECT prod_id, prod_name,... FROM products LIMIT $From, $To where $From and $To values depend of on what page you are. let say there are 100 products and I'm listing 25 products per page.

[PHP] Additional query for number of records in table

2006-11-17 Thread afan
hi, I have query to select products for specific category from DB, something like: SELECT prod_id, prod_name,... FROM products LIMIT $From, $To where $From and $To values depend of on what page you are. let say there are 100 products and I'm listing 25 products per page. for page 1 $From=0, $To=24

Re: [PHP] count string within a string

2006-11-17 Thread Eric Butera
On 11/17/06, Børge Holen <[EMAIL PROTECTED]> wrote: I've figured out I need the substr_count function. However, counting strings like this: [1] [2] [3] ... [215] ... inside a large string element. damn. The string got quite a few different numbers and keys but the main key is alway within [] and

Re: [PHP] Hide Warnings

2006-11-17 Thread Eric Butera
On 11/17/06, Stein Ivar Johnsen <[EMAIL PROTECTED]> wrote: Sorry, I have no access to my ISP's php.ini file. I need to turn off warnings in the php script code? -- Regards sijo http://www.dyg.no "clive" <[EMAIL PROTECTED]> skrev i melding news:[EMAIL PROTECTED] > Stein Ivar Johnsen wrote: >>

[PHP] count string within a string

2006-11-17 Thread Børge Holen
I've figured out I need the substr_count function. However, counting strings like this: [1] [2] [3] ... [215] ... inside a large string element. damn. The string got quite a few different numbers and keys but the main key is alway within [] and is numeric. I imagine I could use a $counter++. I j

RE: [PHP] odd behavior of stripos() with === operator *LAST POST*

2006-11-17 Thread Ford, Mike
On 17 November 2006 16:50, Stut wrote: > > > Your basic misunderstanding is that === is the opposite of !== > > > which it's not. Complete rubbish -- it so absolutely is! If $a===$b, then !($a===$b) is the same as $a!==$b, QED. > > >(INTEGER === true) will always be false because the type

Re: [PHP] Converting array keys to variables?

2006-11-17 Thread Ashley M. Kirchner
Jochem Maas wrote: $file = $array[0][file]; $path = $array[0][path]; $year = $array[0][year]; $month = $array[0][month]; $day = $array[0][day]; $hhmm = $array[0][hhmm]; where the are your quotes for the array keys? have an E_NOTICE or six. I was typing fast and

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

2006-11-17 Thread Stut
Ok, just to shut you all up, I managed to convince the OP earlier today, but it never made it to the list... Michael wrote: At 02:58 AM 11/17/2006 , Stut wrote: Michael wrote: This will be my last post on this thread of discussion. Thanks to all who replied, I have it figured out. I

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

2006-11-17 Thread tedd
At 2:54 AM -0700 11/17/06, Michael wrote: Logic dictates that if something evaluates to NOT FALSE it must be TRUE. Regardless of the type, regardless of the species, breed, flavor etc. Not true -- it depends upon your reference/environment. For example, NULL is neither true nor false in MySQL.

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

2006-11-17 Thread Jochem Maas
Robert Cummings wrote: > On Fri, 2006-11-17 at 17:29 +0100, Jochem Maas wrote: >> Robert Cummings wrote: >>> On Fri, 2006-11-17 at 02:54 -0700, Michael wrote: This will be my last post on this thread of discussion. Thanks to all who replied, I have it figured out. I guess m

Re: [PHP] Converting array keys to variables?

2006-11-17 Thread Jochem Maas
Ashley M. Kirchner wrote: > >I have an array that looks like this: > >[hours] => Array >( >[0] => Array >( >[file] => capture.0400.jpg >[path] => spool/.2006/11/17/04 >[year] => 2006 >

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

2006-11-17 Thread Robert Cummings
On Fri, 2006-11-17 at 17:29 +0100, Jochem Maas wrote: > Robert Cummings wrote: > > On Fri, 2006-11-17 at 02:54 -0700, Michael wrote: > >> This will be my last post on this thread of discussion. > >> > >> Thanks to all who replied, I have it figured out. > >> > >> I guess my only problem with the wa

Re: [PHP] Converting array keys to variables?

2006-11-17 Thread Robert Cummings
On Fri, 2006-11-17 at 09:23 -0700, Ashley M. Kirchner wrote: > I have an array that looks like this: > > [hours] => Array > ( > [0] => Array > ( > [file] => capture.0400.jpg > [path] => spool/.2006/11/17/04 >

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

2006-11-17 Thread Jochem Maas
Robert Cummings wrote: > On Fri, 2006-11-17 at 02:54 -0700, Michael wrote: >> This will be my last post on this thread of discussion. >> >> Thanks to all who replied, I have it figured out. >> >> I guess my only problem with the way the !== and === operators work in this >> situation is this: >> >

Re: [PHP] Converting array keys to variables?

2006-11-17 Thread Chris Boget
Is there a way that I can simply loop through each array and convert the keys into variables? I want to avoid having to write lines of: Look into extract(). http://us3.php.net/manual/en/function.extract.php thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit

[PHP] Converting array keys to variables?

2006-11-17 Thread Ashley M. Kirchner
I have an array that looks like this: [hours] => Array ( [0] => Array ( [file] => capture.0400.jpg [path] => spool/.2006/11/17/04 [year] => 2006 [month] => 11 [da

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

2006-11-17 Thread Robert Cummings
On Fri, 2006-11-17 at 02:54 -0700, Michael wrote: > This will be my last post on this thread of discussion. > > Thanks to all who replied, I have it figured out. > > I guess my only problem with the way the !== and === operators work in this > situation is this: > > Logic dictates that if somet

RE: [PHP] odd behavior of stripos() with === operator *LAST POST*

2006-11-17 Thread Brad Fuller
> > Logic dictates that if something evaluates to NOT FALSE it > > must be TRUE. In a situation where you are only dealing with boolean values, that above statement would be correct. In this case it is not. int stripos ( string haystack, string needle [, int offset] ) What you are missi

Re: [PHP] file_get_contents

2006-11-17 Thread Jochem Maas
Stut wrote: > Tom Chubb wrote: >> The host support team told me that: >> Our servers do not allows a HTTP connection onto itself. This is a >> security precaution to stop recursive code. morons '; teachTheIdiotSysAdmin(); } ?> >> You can try to reference >> the code by path rather

Re: [PHP] file_get_contents

2006-11-17 Thread Stut
Tom Chubb wrote: The host support team told me that: Our servers do not allows a HTTP connection onto itself. This is a security precaution to stop recursive code. You can try to reference the code by path rather than HTTP ...which works fine! Won't something like this work... ob_start(); // I

Re: [PHP] file_get_contents

2006-11-17 Thread Tom Chubb
The host support team told me that: Our servers do not allows a HTTP connection onto itself. This is a security precaution to stop recursive code. You can try to reference the code by path rather than HTTP ...which works fine! On 17/11/06, Tom Chubb <[EMAIL PROTECTED]> wrote: Very interesting!

RE: [PHP] odd behavior of stripos() with === operator *LAST POST*

2006-11-17 Thread Ford, Mike
On 17 November 2006 09:55, Michael wrote: > This will be my last post on this thread of discussion. > > Thanks to all who replied, I have it figured out. > > I guess my only problem with the way the !== and === > operators work in this situation is this: > > Logic dictates that if something eva

Re: [PHP] file_get_contents

2006-11-17 Thread Tom Chubb
Very interesting! I have a reseller account and on another site, the DNS entries were messed up by the host. Could be a similar problem. Thanks On 17/11/06, Stut <[EMAIL PROTECTED]> wrote: Tom Chubb wrote: > Confused! > I'm now getting: > file_get_contents(http://www.tnhosting.co.uk/scripts/gclu

Re: [PHP] Update function for content of existing CD?

2006-11-17 Thread Jochem Maas
Frank Arensmeier wrote: > Hello all. > > I am looking for some ideas on how to design / structure a script which > checks for updates on files on a existing CD ROM. > > Every week, I generate content for a CD ROM containing a large number of > html pages and PDF files (the CD is distributed to 20

Re: [PHP] file_get_contents

2006-11-17 Thread Tom Chubb
On 17/11/06, Jochem Maas <[EMAIL PROTECTED]> wrote: Tom Chubb wrote: > 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/scr

Re: [PHP] Problem with wanting something NOT to round

2006-11-17 Thread Stut
George Pitcher wrote: I am using PHP5.1 with Smarty templates on my page (but not on the standalone page). Smarty doesn't offer anything other than the sprintf() options for string formatting of decimal numbers, and I'm already doing that. Do you think Smarty could be so unsmart as to undo the

Re: [PHP] file_get_contents

2006-11-17 Thread Stut
Tom Chubb wrote: 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 acce

Re: [PHP] file_get_contents

2006-11-17 Thread Jochem Maas
Tom Chubb wrote: > 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

RE: [PHP] Problem with wanting something NOT to round

2006-11-17 Thread George Pitcher
> George Pitcher wrote: > >> Are you sure the web service is giving you 160.44? I get it > displayed as > >> expected... > >> > >> http://dev.stut.net/php/pitcher.php > >> > > Yes, I am echoing the 160.44 ok. I'm just not getting the 44c > in my display > > price. I'm on Windows NT - could that

Re: [PHP] Hide Warnings

2006-11-17 Thread Kevin Waterson
This one time, at band camp, "Stein Ivar Johnsen" <[EMAIL PROTECTED]> wrote: > Hi.. > > How can I hide Warning messages so they are not shown on screen..: code properly... -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vot

Re: [PHP] Hide Warnings

2006-11-17 Thread clive
Stein Ivar Johnsen wrote: I have tried "error_reporting(0);" but this does not help. The program is still writing warnings to screen. My ISP is using PHP Version 4.3.10 if that is any help. I have no access to the PHP.INI file. Any more ideas, please? fix the code thats generating the errors?

RE: [PHP] Problem with wanting something NOT to round

2006-11-17 Thread George Pitcher
> George Pitcher wrote: > > As part of a result from a web-service call, I get a price in > dollars and > > cents as a decimal number eg.160.44 (the example I am working on. This > > price is for permission to re-use some published material and for each > > additional separate pagerange, $3 needs

Re: [PHP] Problem with wanting something NOT to round

2006-11-17 Thread Stut
George Pitcher wrote: Are you sure the web service is giving you 160.44? I get it displayed as expected... http://dev.stut.net/php/pitcher.php Yes, I am echoing the 160.44 ok. I'm just not getting the 44c in my display price. I'm on Windows NT - could that be a factor? I'm not sure w

Re: [PHP] Problem with wanting something NOT to round

2006-11-17 Thread Stut
George Pitcher wrote: As part of a result from a web-service call, I get a price in dollars and cents as a decimal number eg.160.44 (the example I am working on. This price is for permission to re-use some published material and for each additional separate pagerange, $3 needs to be added afterw

Re: [PHP] Hide Warnings

2006-11-17 Thread Stein Ivar Johnsen
Sorry, I have no access to my ISP's php.ini file. I need to turn off warnings in the php script code? -- Regards sijo http://www.dyg.no "clive" <[EMAIL PROTECTED]> skrev i melding news:[EMAIL PROTECTED] > Stein Ivar Johnsen wrote: >> Hi.. >> >> How can I hide Warning messages so they are not

Re: [PHP] Hide Warnings

2006-11-17 Thread Stein Ivar Johnsen
I have tried "error_reporting(0);" but this does not help. The program is still writing warnings to screen. My ISP is using PHP Version 4.3.10 if that is any help. I have no access to the PHP.INI file. Any more ideas, please? -- Regards sijo http://www.dyg.no ""Tom Chubb"" <[EMAIL PROTECTED]>

[PHP] Problem with wanting something NOT to round

2006-11-17 Thread George Pitcher
Hi, As part of a result from a web-service call, I get a price in dollars and cents as a decimal number eg.160.44 (the example I am working on. This price is for permission to re-use some published material and for each additional separate pagerange, $3 needs to be added afterwards. So I have th

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

2006-11-17 Thread Michael
This will be my last post on this thread of discussion. Thanks to all who replied, I have it figured out. I guess my only problem with the way the !== and === operators work in this situation is this: Logic dictates that if something evaluates to NOT FALSE it must be TRUE. Regardless of the typ

Re: [PHP] Hide Warnings

2006-11-17 Thread clive
Stein Ivar Johnsen wrote: Hi.. How can I hide Warning messages so they are not shown on screen..: look in your php.ini file and set error_reporting to an appropriate value or set display_errors to off -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.ne

Re: [PHP] Hide Warnings

2006-11-17 Thread Tom Chubb
Choose one of the following, but if you are getting warnings, something is wrong and you should address it. On 16/11/06, Stein Ivar Johnsen <[EMAIL PROTECTED]> wrote: Hi.. How can I hide Warning messages so they are not shown on screen..: Warning: Call-time pass-by-reference has been deprecat

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

2006-11-17 Thread Stut
Michael wrote: I understand that the integer 0 and FALSE are different and I read the manual so many times my head hurts, heh. There are a few ways to work around this, probably more than I know. (according to the documentation for strrpos() you could test the return from stripos() for is_bool

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

2006-11-17 Thread Stut
Please include the list in replies. Michael wrote: Why can't === realize that integer 0 means TRUE? whereas "" or a BOOLEAN false does not? === evaluates integer 0 to FALSE :( the !== operator recognizes the difference. "(integer) 0 !== FALSE" is TRUE yet "(integer) 0 === TRUE" is FALSE, bu

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

2006-11-17 Thread Michael
At 02:33 AM 11/17/2006 , Stut wrote: >Michael wrote: >> I understand that the integer 0 and FALSE are different and I read the >> manual so many times my head hurts, heh. >> >> There are a few ways to work around this, probably more than I know. >> (according to the documentation for strrpos() yo

[PHP] Hide Warnings

2006-11-17 Thread Stein Ivar Johnsen
Hi.. How can I hide Warning messages so they are not shown on screen..: Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass

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

2006-11-17 Thread Michael
At 02:10 AM 11/17/2006 , Stut wrote: >Michael wrote: >> Ok, picking gnits... >> I should have said NOT true and NOT false at the same time. >> As for the return of the integer 0.. >> The documentation indicates that the === and !== operators take this into >> account in fact there is a specific ex

[PHP] Update function for content of existing CD?

2006-11-17 Thread Frank Arensmeier
Hello all. I am looking for some ideas on how to design / structure a script which checks for updates on files on a existing CD ROM. Every week, I generate content for a CD ROM containing a large number of html pages and PDF files (the CD is distributed to 20 - 30 dealers for ours) . The

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

2006-11-17 Thread Stut
Michael wrote: I'm not sure why the === operator does not handle this condition, since the wonderful people at PHP foresaw the problem and fixed !== to handle it, I would like to see the === fixed to handle this as well (if it is even possible, not sure about how this is implemented??) Th

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

2006-11-17 Thread Stut
Michael wrote: Ok, picking gnits... I should have said NOT true and NOT false at the same time. As for the return of the integer 0.. The documentation indicates that the === and !== operators take this into account in fact there is a specific example in the manual. My point here is that if !==

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

2006-11-17 Thread Michael
At 12:24 AM 11/17/2006 , 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 done something >wrong

Re: [PHP] Re: Space in regex

2006-11-17 Thread Dotan Cohen
On 17/11/06, Paul Novitski <[EMAIL PROTECTED]> wrote: 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 th