Re: [PHP] Replacement Question.

2005-04-22 Thread Richard Lynch
On Wed, April 20, 2005 7:22 am, Bob Palma said:
 I have a database field that I need to read and do some conversion on.
 Here is what the raw data from the database looks like:

 --
 1084751309jpenaDisney Vignette Fleximon disk utilization
 alert C:\ at 85%1084799703bpalmafixed.1084799713bpalmaclosed
 --

 After conversion, it should look like this:

 --
 5/16/2004 7:48:29 PM jpena
 Disney Vignette Fleximon disk utilization alert C:\ at 85%

 5/17/2004 9:15:03 AM bpalma
 fixed.

 5/17/2004 9:15:13 AM bpalma
 closed
 --


 I have tried to use eregi_replace to convert the timestamps to DateTime,
 but I end up with all three timestamps being changed to the same time
 (5/16/2004 7:48:29 PM).

 Here is the quick, albeit ugly, code I've tried to come close

 --
 $worklogt3 = eregi_replace(,br, $worklogt1);
 $worklogt4 = eregi_replace(,brbr, $worklogt3);
 $worklog = eregi_replace([0-9]{10,10},date(m/j/y g:i
   a,$worklogt4),$worklogt4);
 --

 $worklogt1 is the value of the field from the database and the first two
 replacements are actually for different characters, even though they
 look the same.

 Can anyone help me with this?  I've been beating myself up for almost
 three days over this.

Your problem is that you are passing in all of $worklogt4 to the date
function, and that *BEGINS* with the first date/time, and that's what PHP
uses.

You need to FIRST break up your single line into separeate lines, based on
the 10-digit time-stamps.

Something like:
$lines = split('[0-9]{10,10}', $worklogt4);

But then I'm not sure you get to keep the date/time -- I never use split
much, myself...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Replacement Question.

2005-04-20 Thread Bob Palma
I have a database field that I need to read and do some conversion on. 
Here is what the raw data from the database looks like:

--
1084751309jpenaDisney Vignette Fleximon disk utilization 
alert C:\ at 85%1084799703bpalmafixed.1084799713bpalmaclosed
--

After conversion, it should look like this:
--
5/16/2004 7:48:29 PM jpena
Disney Vignette Fleximon disk utilization alert C:\ at 85%
5/17/2004 9:15:03 AM bpalma
fixed.
5/17/2004 9:15:13 AM bpalma
closed
--
I have tried to use eregi_replace to convert the timestamps to DateTime, 
but I end up with all three timestamps being changed to the same time 
(5/16/2004 7:48:29 PM).

Here is the quick, albeit ugly, code I've tried to come close
--
$worklogt3 = eregi_replace(,br, $worklogt1);
$worklogt4 = eregi_replace(,brbr, $worklogt3);
$worklog = eregi_replace([0-9]{10,10},date(m/j/y g:i
a,$worklogt4),$worklogt4);
--
$worklogt1 is the value of the field from the database and the first two 
replacements are actually for different characters, even though they 
look the same.

Can anyone help me with this?  I've been beating myself up for almost 
three days over this.

Thanks in Advance,
Bob Palma
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Replacement Question.

2005-04-20 Thread Duncan Hill
On Wednesday 20 April 2005 15:22, Bob Palma typed:
 I have a database field that I need to read and do some conversion on.
 Here is what the raw data from the database looks like:

 --
 1084751309jpenaDisney Vignette Fleximon disk utilization
 alert C:\ at 85%1084799703bpalmafixed.1084799713bpalmaclosed
 --

Are the group delimiters different from the field delimiters?

Ie, can you do:
$array_of_groups = explode('group_delim', $in_string);
foreach ($array_of_groups as $i) {
 $array_of_fields = explode('field_delim', $i);
 $date = date('m/j/y g:i:a', $array_of_fields[0]);
 print $date {$a_o_f[1]}br /{$a_o_f[2]}br /br /\n;
}

YMMV of course.

-- 
My mind not only wanders, it sometimes leaves completely.

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



Re: [PHP] Replacement Question.

2005-04-20 Thread Bob Palma
Wow!  Thanks.. That works great.  Just one small hitch though.  After it 
prints all of the data properly, it adds one more '$date' on the end 
which gets printed as '12/31/69 7:00:pm'.  Is there a way to do all 
groups - 1 ?

Bob Palma
[EMAIL PROTECTED]
Duncan Hill wrote:
On Wednesday 20 April 2005 15:22, Bob Palma typed:
I have a database field that I need to read and do some conversion on.
Here is what the raw data from the database looks like:
--
1084751309jpenaDisney Vignette Fleximon disk utilization
alert C:\ at 85%1084799703bpalmafixed.1084799713bpalmaclosed
--

Are the group delimiters different from the field delimiters?
Ie, can you do:
$array_of_groups = explode('group_delim', $in_string);
foreach ($array_of_groups as $i) {
 $array_of_fields = explode('field_delim', $i);
 $date = date('m/j/y g:i:a', $array_of_fields[0]);
 print $date {$a_o_f[1]}br /{$a_o_f[2]}br /br /\n;
}
YMMV of course.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Replacement Question.

2005-04-20 Thread Duncan Hill
On Wednesday 20 April 2005 16:01, Bob Palma typed:
 Wow!  Thanks.. That works great.  Just one small hitch though.  After it
 prints all of the data properly, it adds one more '$date' on the end
 which gets printed as '12/31/69 7:00:pm'.  Is there a way to do all
 groups - 1 ?

No reason for it to do that unless your data is a bit weird.

Use print_r() or var_dump to see what each array contains - you might find you 
have a blank entry being tacked on somehow (which you could detect with an 
if).

-- 
My mind not only wanders, it sometimes leaves completely.

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



Re: [PHP] Replacement Question.

2005-04-20 Thread Bob Palma
Thanks.  I took a look, and you were right.  It was creating another 
entry in the array at the end, so I used an if statement checking the 
value of [1] and [2] in $array_of_fields.

Thanks for all the great help
Bob Palma
[EMAIL PROTECTED]
Duncan Hill wrote:
On Wednesday 20 April 2005 16:01, Bob Palma typed:
Wow!  Thanks.. That works great.  Just one small hitch though.  After it
prints all of the data properly, it adds one more '$date' on the end
which gets printed as '12/31/69 7:00:pm'.  Is there a way to do all
groups - 1 ?

No reason for it to do that unless your data is a bit weird.
Use print_r() or var_dump to see what each array contains - you might find you 
have a blank entry being tacked on somehow (which you could detect with an 
if).

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


[PHP] replacement

2005-01-25 Thread Jerry Swanson
I'm trying to replace a substr of the string that start from Rated
blahblah; azt the end semicolon.

Example:
safsagfasdfsdfdsfRated by 4 people;fafafaafafaf - return
safsagfasdfsdfdsffafafaafafaf

$replacement =; 
$pattern = /Rated.+;/; 
$found_str = preg_replace($pattern, $replacement, $found_str);

Why this above, doesn't work?

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



RE: [PHP] replacement

2005-01-25 Thread Jay Blanchard
[snip]
I'm trying to replace a substr of the string that start from Rated
blahblah; azt the end semicolon.

Example:
safsagfasdfsdfdsfRated by 4 people;fafafaafafaf - return
safsagfasdfsdfdsffafafaafafaf

$replacement =; 
$pattern = /Rated.+;/; 
$found_str = preg_replace($pattern, $replacement, $found_str);

Why this above, doesn't work?
[/snip]

What does it return? Try this ...

$string = safsagfasdfsdfdsfRated by 4 people;fafafaafafaf;

$replacement =;
$pattern = /Rated.+;/;
$found_str = preg_replace($pattern, $replacement, $string);

echo $found_str;

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



Re: [PHP] Frontpage Discussion Group/PHP Replacement

2001-01-13 Thread Richard Lynch

I dunno about importing the data, but Phorum is a pretty darned good PHP
discussion group program...

Hopefully, FP just stores all the stuff in some tables and you can export
the data as CSV or tab-delimited.

- Original Message -
From: "Cybercandy Ltd" [EMAIL PROTECTED]
Newsgroups: php.general
Sent: Saturday, January 13, 2001 10:02 AM
Subject: [PHP] Frontpage Discussion Group/PHP Replacement


 A bit of an embarrassing question this,
 and a long shot too.  Please don't laugh.

 Does anyone know if there is a php program
 that I can use to replace the discussion group in frontpage 2000.

 I want something that can read the existing discussion files generated
 by FP200 so that I don't have to start from scratch and throw
 away existing discussions.

 Needless to say the fronpage 2000 server extensions that run
 the board I have at the moment have broken.

 Any suggestions appreciated.

 Allan
 Cybercandy



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]