Re: [PHP] php cli and mysql

2006-11-15 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-11-14 18:56:01 -0500: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2006-11-14 20:17:16 +0200: On 11/14/06, James Tu [EMAIL PROTECTED] wrote: I'm running a php script from the command line (I'm on OS X) and I'm getting ... Warning: mysql_connect(): Can't

Re: [PHP] CSS / PHP / Javascript

2006-11-15 Thread Dave Goodchild
Good responses here - I tend to use MS conditional comments as I only resort to hacks when there (seems) to be no other way, and although conditional comments are proprietary they are ignored as comments by other browsers and are hence pretty harmless. Yes, for example Opera identifies itself as

Re: [PHP] php cli and mysql

2006-11-15 Thread Frank Arensmeier
FYI - the problem with mysql.sock has been an support issue at apple.com before. http://docs.info.apple.com/article.html?artnum=301457 /frank 15 nov 2006 kl. 11.03 skrev Roman Neuhauser: # [EMAIL PROTECTED] / 2006-11-14 18:56:01 -0500: Roman Neuhauser wrote: # [EMAIL PROTECTED] /

Re: [PHP] Splitting a string

2006-11-15 Thread Robin Vickery
On 15/11/06, Aaron Koning [EMAIL PROTECTED] wrote: Assuming var1 and var2 only ever use the last four numbers (untested): $length = strlen($number); // get string length $var1 = substr($number,0,$length-4); // get number until only 4 numbers are left $var2 = substr($number,$length-4,2); // get

Re: [PHP] Regular expressions

2006-11-15 Thread John Meyer
Darrell Brogdon wrote: Can you elaborate a little? Do you mean that you want certain letters to have a numeric representation? -D no, what I was meaning was in relationship to each other, whether they are the same letter or not. -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Splitting a string

2006-11-15 Thread Børge Holen
On Wednesday 15 November 2006 06:24, you wrote: At 11/14/2006 03:17 PM, Børge Holen wrote: $number = 123456789 should print as following: var1: 12345 (and it is this lengt witch varies) var2: 67 var3: 89. You can also do this with a regular expression: $iNumber = '123456789';

Re: [PHP] Regular expressions

2006-11-15 Thread Dave Goodchild
Is there a way to make a regular expression to match on a particular way the letters are arranged? For instance, if you had a word: THAT It could match on any word in the dictionary that had the form: 1231 preg_,match('/^(\w){1}\w\w\1$/'); would match the above on a single line for

Re: [PHP] Splitting a string

2006-11-15 Thread Børge Holen
On Wednesday 15 November 2006 12:42, Robin Vickery wrote: On 15/11/06, Aaron Koning [EMAIL PROTECTED] wrote: Assuming var1 and var2 only ever use the last four numbers (untested): $length = strlen($number); // get string length $var1 = substr($number,0,$length-4); // get number until only

Re: [PHP] Regular expressions

2006-11-15 Thread John Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Okay, what I am referring to is cryptograms, where one letter is substituted for another. I would like to be able to list all the words in a dictionary that have that arrangement of their letters. Later on, I would like to be able to do an entire

Re: [PHP] Regular expressions

2006-11-15 Thread David Tulloh
John Meyer wrote: Is there a way to make a regular expression to match on a particular way the letters are arranged? For instance, if you had a word: THAT It could match on any word in the dictionary that had the form: 1231 I think something like this might be possible using

Re: [PHP] Mysql strategy

2006-11-15 Thread David Tulloh
Chris wrote: David Tulloh wrote: Dotan Cohen wrote: If I have to perform 30 LIKE searches for different keywords in a varchar field, which strategy would be recommended: 1) 30 searches, one for each keyword 2) To select the varchar field from all the rows, and search through them with php's

Re: [PHP] CSS / PHP / Javascript

2006-11-15 Thread Jochem Maas
hmmm, this reply turned into something that resembles a rant about halfway thru... still ... maybe it's helpful in some way. Ed Lazor wrote: I'm reading a book on CSS and how you can define different style sheets for different visitors. I'm wondering how you guys do it. The book recommends

Re: Fwd: [PHP] Highjack?

2006-11-15 Thread tedd
At 11:02 PM + 11/14/06, Tom Chubb wrote: Posts like this are what makes this list so great! It's better to read this here than experience it first hand! Thanks Tedd, for highlighting the problem. Tom Tom: You're welcome, but I never have a problem showing my ignorance. -- that just

[PHP] Re: CSS / PHP / Javascript

2006-11-15 Thread Al
Ed Lazor wrote: I'm reading a book on CSS and how you can define different style sheets for different visitors. I'm wondering how you guys do it. The book recommends using Javascript functions for identifying the user's browser and matching them with the corresponding style sheets. Anyone

[PHP] Checking file existence

2006-11-15 Thread Ashley M. Kirchner
I have files that are named in the following manner: file..jpg (where is an hhmm timestamp [hour and minutes]) What's the best way to take the current hhmm timestamp and run backwards finding the previous 5 files, and checking whether they actually exist? There's a

Re: [PHP] Checking file existence

2006-11-15 Thread Jürgen Wind
Ashley M. Kirchner wrote: I have files that are named in the following manner: file..jpg (where is an hhmm timestamp [hour and minutes]) What's the best way to take the current hhmm timestamp and run backwards finding the previous 5 files, and checking whether

Re: [PHP] Checking file existence

2006-11-15 Thread Jürgen Wind
sorry, clicked on send too fast ;) i'd extract the minues and seconds , generate an array of timestamps and sort that array desc -- View this message in context: http://www.nabble.com/Checking-file-existence-tf2636778.html#a7359891 Sent from the PHP - General mailing list archive at

Re: [PHP] Checking file existence

2006-11-15 Thread Jochem Maas
one solution could probably be made using: glob(), sort() and/or filemtime(). btw: I assume your aware that the filenames are not very unique (i.e. twice a day, everyday a given file will potentially be overwritten) and that this is intentional Ashley M. Kirchner wrote: I have files that

Re: [PHP] Checking file existence

2006-11-15 Thread Ashley M. Kirchner
Edward Kay wrote: Are all the files called file..jpg or could they have other names such as clouds.1123.jpg, field.2034.jpg etc? They are all the same exact file name with the only difference being the timestamp. Alternatively, you could get the OS to do the work through an exec call

[PHP] test

2006-11-15 Thread bruce
test -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Checking file existence

2006-11-15 Thread Brad Fuller
UntestedCode $img_array = array(); $i = 0; while(count($img_array) 5) { $hhmm = date(Hi, strtotime(-$i minutes)); $filename = file.$hhmm.jpg; if(file_exists(/path/to/$filename)) { $img_array[] = $filename; } $i++; }

[PHP] __get() accessor question (a bug maybe?)

2006-11-15 Thread TemuriI
Hi all, here is the code I am having problem with: class baseForm { private $_id = 10; function __get($member) { echo Accessing member \{$member}\ : br /\n; return $this-$member; } function checkID() { echo

[PHP] Re: __get() accessor question (a bug maybe?)

2006-11-15 Thread Barry
TemuriI schrieb: Hi all, here is the code I am having problem with: class baseForm { private $_id = 10; function __get($member) { echo Accessing member \{$member}\ : br /\n; return $this-$member; } function checkID()

RE: [PHP] Checking file existence

2006-11-15 Thread Brad Fuller
MoreUntestedCode $img_array = array(); $i = 0; while(count($img_array) 5) { $year = date(Y, strtotime(-$i minutes)); $month= date(m, strtotime(-$i minutes)); $day = date(d, strtotime(-$i minutes)); $hour = date(H, strtotime(-$i minutes)); $hhmm =

[PHP] Re: __get() accessor question (a bug maybe?)

2006-11-15 Thread TemuriI
Hi, thanks for the response. But the thing with __get() _set() is that the members should either be *not* declared or be of private type to trigger accessor functions. That's the reason I have _id as private (also to trigger some other action when __set() fires up). Now, it gets inherited

RE: [PHP] Checking file existence

2006-11-15 Thread Edward Kay
Hi Ashley, Are all the files called file..jpg or could they have other names such as clouds.1123.jpg, field.2034.jpg etc? If they all have the same name, you could use something like scandir() and then just use the first 5 items in the returned array. You could also loop through the

[PHP] Re: __get() accessor question (a bug maybe?)

2006-11-15 Thread Barry
TemuriI schrieb: just a small idea. public function __get() {...} Might work *untested* -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] __get() accessor question (a bug maybe?)

2006-11-15 Thread Edward Kay
From what I see, the __get() accessor function is triggerred only from OUTSIDE the class. From my understanding of OOP, that is how it should behave. __get and __set methods are there to abstract away the actual member variables and provide a consistent interface to other classes. When

[PHP] Re: __get() accessor question (a bug maybe?)

2006-11-15 Thread TemuriI
Barry, that did not work. Look, you said that $_id is of type private and that's why it cannot be accessed. However, I am trying to access it from checkID() that is a method of the same base class. Any clue why it does not work? Thx, Temuri Barry wrote: TemuriI schrieb: just a small

RE: [PHP] date() function

2006-11-15 Thread Ivo F.A.C. Fokkema
On Tue, 14 Nov 2006 15:11:56 -0500, Brad Fuller wrote: $prevminute = sprintf('%02s', date(i)-1); Or, $prevminute = str_pad(date(i)-1, 2, '0', STR_PAD_LEFT); It's a little more code - don't ask me about the speed :) Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

RE: [PHP] Checking file existence

2006-11-15 Thread Edward Kay
Surely it would be simpler to store all this info in a database table? e.g. id : int created : timestamp filename : varchar Only files that actually existed would be in the DB, plus you could do all your sorting on the 'created' timestamp column. Querying the DB should be much simpler

RE: [PHP] Checking file existence

2006-11-15 Thread John Pillion
Very nifty Brad, One addition though, so she/you can work back from any point: MoreUntestedCode $i = 0; $start = strtotime(2006-10-05 12:05am); while(count($img_array) 5) { $year = date(Y, strtotime(-$i minutes, $start)); $month= date(m, strtotime(-$i minutes, $start));

Re: [PHP] __get() accessor question (a bug maybe?)

2006-11-15 Thread Jochem Maas
TemuriI wrote: Hi all, here is the code I am having problem with: class baseForm { private $_id = 10; function __get($member) { echo Accessing member \{$member}\ : br /\n; return $this-$member; } function

Re: [PHP] __get() accessor question (a bug maybe?)

2006-11-15 Thread TemuriI
Hi Edward, What I am trying to do is to write a set of classes that generate HTML code for HTML form elements (input type=text, textarea, hidden, buttons, etc). Now I thought I'd define a base class that would have properties common to all form elements, like: value, name, id, title, css

Re: [PHP] __get() accessor question (a bug maybe?)

2006-11-15 Thread Marc Gear
class baseForm { private $_id = 10; function __get($member) { echo Accessing member \{$member}\ : br /\n; return $this-$member; } function checkID() { echo $this-_id.br /\n; } } class inputText extends baseForm { function display() {

Re: [PHP] __get() accessor question (a bug maybe?)

2006-11-15 Thread Stut
TemuriI wrote: class baseForm { private $_id = 10; function __get($member) { echo Accessing member \{$member}\ : br /\n; return $this-$member; } function checkID() { echo $this-_id.br /\n; } } class inputText extends baseForm { function display()

Re: [PHP] Checking file existence

2006-11-15 Thread Ashley M. Kirchner
Stut wrote: mall, minor, insignificant point If I have less than 5 files this loop will never end. But you all knew that right? Yup. I break out of the loop if $i reaches 10 for some weird reason. Also, depending on the frequency of files (i.e. are there months-worth of gaps or

Re: [PHP] Checking file existence

2006-11-15 Thread tedd
At 8:18 AM -0700 11/15/06, Ashley M. Kirchner wrote: I have files that are named in the following manner: file..jpg (where is an hhmm timestamp [hour and minutes]) What's the best way to take the current hhmm timestamp and run backwards finding the previous 5 files, and

Re: [PHP] Checking file existence

2006-11-15 Thread Stut
John Pillion wrote: Very nifty Brad, One addition though, so she/you can work back from any point: MoreUntestedCode $i = 0; $start = strtotime(2006-10-05 12:05am); while(count($img_array) 5) { $year = date(Y, strtotime(-$i minutes, $start)); $month= date(m, strtotime(-$i

[PHP] Function Misbehaving

2006-11-15 Thread Programmer
The following function is a basic user auth prep procedure for multiple pages. If the url desired is different than the default a url is supplied. This function works most of the time flawlessly; except, on some pages when the url has a value that was passed, the function still thinks url is

RE: [PHP] Highjack?

2006-11-15 Thread bruce
hi chris... for the initial post, it does/did matter for register_globals to be on/off. in your reply, you use a $_GET[..] for the $path var. in the initial post that i saw, (which i replied to), the $path var was simply used, without the $_GET[..]. it's my understanding (recollection) that if

[PHP] How to output an MP3 file?

2006-11-15 Thread Brian Dunning
I'm trying to route all my MP3 requests through a brief PHP script to log the downloads to a database, and then I want to output the MP3 exactly as if the browser had requested it normally. So far I haven't found headers that will serve it normally; it either wants to download it as an

Re: [PHP] How to output an MP3 file?

2006-11-15 Thread Jon Anderson
Brian Dunning wrote: header('Content-Type: application/octet-stream'); snip What should I change? I think you should use a content type more specific to MP3s. My install of firefox seems to think the appropriate content type for those is audio/mpeg - try that, and see what happens.

RE: [PHP] Function Misbehaving

2006-11-15 Thread Programmer
Problem solved: the reason print($url) caused the program to work is because the page calling Secure_Login no longer existed and therefore the print forced a die--I assume. I included a die in the redirect function and all was well. Including die in the redirect function made sure the page that

Re: [PHP] How to output an MP3 file?

2006-11-15 Thread Brian Dunning
Thanks Jon - You put me on the right track. Apparently audio/x-mp3 is what iTunes wants to see, and it seems to work with browsers. :) On Nov 15, 2006, at 10:06 AM, Jon Anderson wrote: Brian Dunning wrote: header('Content-Type: application/octet-stream'); snip What should I change?

Re: [PHP] Function Misbehaving

2006-11-15 Thread Tom Chubb
On 15/11/06, Programmer [EMAIL PROTECTED] wrote: Problem solved: the reason print($url) caused the program to work is because the page calling Secure_Login no longer existed and therefore the print forced a die--I assume. I included a die in the redirect function and all was well. Including

[PHP] cURL uses

2006-11-15 Thread Philip Thompson
Hi. I've been doing some reading trying to figure out why I would want to use cURL. I have not found a solid reason yet. Does anyone have a useful example on why you would want to use cURL? Thanks, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] cURL uses

2006-11-15 Thread Dave Goodchild
You would use cURL to achieve the things cURL is built to achieve?

Re: [PHP] cURL uses

2006-11-15 Thread Jon Anderson
Philip Thompson wrote: I've been doing some reading trying to figure out why I would want to use cURL. I have not found a solid reason yet. Does anyone have a useful example on why you would want to use cURL? It allows significant configurability and flexibility over PHP's more direct

Re: [PHP] cURL uses

2006-11-15 Thread Eric Butera
On 11/15/06, Philip Thompson [EMAIL PROTECTED] wrote: Hi. I've been doing some reading trying to figure out why I would want to use cURL. I have not found a solid reason yet. Does anyone have a useful example on why you would want to use cURL? Thanks, ~Philip -- PHP General Mailing List

Re: [PHP] cURL uses

2006-11-15 Thread cajbecu
well, there are more reasons you should use cURL .. - control and flexibility of the output, - post variables, - can interact with secure servers (ssl - supports certificates) - can use with proxys (http/socks) - set timeouts - easily modify headers :) - use different ip`s of the server when it`s

Re: [PHP] Splitting a string

2006-11-15 Thread Børge Holen
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 actually could be shorter (just found out) and the code didn't work with fewer than 5 char strings. But now is rocks.

Re: [PHP] Highjack?

2006-11-15 Thread Chris
bruce wrote: hi chris... for the initial post, it does/did matter for register_globals to be on/off. in your reply, you use a $_GET[..] for the $path var. in the initial post that i saw, (which i replied to), the $path var was simply used, without the $_GET[..]. it's my understanding

Re: [PHP] Splitting a string

2006-11-15 Thread Chris
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. sprintf is your friend here, no need to use a loop. sprintf('%05d', '1234'); -- Postgresql php tutorials http://www.designmagick.com/

Re: [PHP] Splitting a string

2006-11-15 Thread Robert Cummings
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. sprintf is your friend here, no need to use a loop. sprintf('%05d', '1234');

Re: [PHP] Splitting a string

2006-11-15 Thread Chris
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. sprintf is your friend here, no need to use a loop.

Re: [PHP] Splitting a string

2006-11-15 Thread Paul Novitski
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 actually could be shorter (just found out) and the code didn't work with

[PHP] Smart Quotes not so smart

2006-11-15 Thread Larry Garfield
I've run into this sort of issue a few times before, and never found a good solution. Now a client has been hit with it and is asking for a solution, and I'm not convinced there is one. :-) Client has a large MS SQL database with lots of data. Some of that data includes smart quotes, aka

Re: [PHP] Smart Quotes not so smart

2006-11-15 Thread Robert Cummings
On Wed, 2006-11-15 at 20:36 -0600, Larry Garfield wrote: I've run into this sort of issue a few times before, and never found a good solution. Now a client has been hit with it and is asking for a solution, and I'm not convinced there is one. :-) Client has a large MS SQL database with

Re: [PHP] Smart Quotes not so smart

2006-11-15 Thread Travis Doherty
Robert Cummings wrote: On Wed, 2006-11-15 at 20:36 -0600, Larry Garfield wrote: I've run into this sort of issue a few times before, and never found a good solution. Now a client has been hit with it and is asking for a solution, and I'm not convinced there is one. :-) Client has a large