Re: [PHP-DB] Cannot connect to MySQL using

2006-03-30 Thread Constantin Wolber

[EMAIL PROTECTED] wrote:


Then change :

 127.0.0.1   localhost

become :

157.47.115.180  [my_server_name]
 



Changing this line is probably not the best way. This file is used for
resolving the hostnames ti ip adresses. So a better way would probably
be adding the line to the file. Since the entry for localhost should
remain in this file.

Greets Constantin

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



[PHP-DB] Search / Replace using PHP

2006-03-30 Thread Ron Piggott (PHP)
Is there a command in PHP that is equal to the search & replace function
in a word processor?

If I want to search for 'this' and replace it with 'that' what would the
syntax be?

Ron

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



[PHP-DB] Re: Search / Replace using PHP

2006-03-30 Thread João Cândido de Souza Neto
Ron Piggott (PHP wrote:

> Is there a command in PHP that is equal to the search & replace function
> in a word processor?
> 
> If I want to search for 'this' and replace it with 'that' what would the
> syntax be?
> 
> Ron

Look for str_replace().

-- 
---
João Cândido de Souza Neto
Web Developer

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



Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Arie Nugraha
try this :

$date = "30/12/1982 15:30"

if (preg_match("/\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}/i",$date )) {
echo "Date is valid";
} else {
echo "Date NOT valid";
}

hope it will help you

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



Re: [PHP-DB] Re: Search / Replace using PHP

2006-03-30 Thread Arie Nugraha
If you want to have more control on searching and replacing in PHP,
try Regular Exprssion. I myself prefer PERL compatible regular
expression, because is little bit more easy than its POSIX sibling.

try preg_match(), pref_replace() etc.

There is many tutorial about PERL Regex Syntax on the net

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



Re: [PHP-DB] Search / Replace using PHP

2006-03-30 Thread Arie Nugraha
Try this link for PERL regex reference :
http://www.perl.com/doc/manual/html/pod/perlre.html

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



Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Petar Nedyalkov
On Thursday 30 March 2006 16:49, Arie Nugraha wrote:
> try this :
>
> $date = "30/12/1982 15:30"
>
> if (preg_match("/\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}/i",$date )) {
> echo "Date is valid";
> } else {
> echo "Date NOT valid";
> }

This is not correct since you don't check the ranges of the day digits, month 
digits, etc.
The easiest way to check the string is to explode it by " " (space), then 
explode the first part by slash and the second by column, and at last check 
the ranges.
A regular expression will be much more complex.

>
> hope it will help you

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgp2hDxdXtsfb.pgp
Description: PGP signature


Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Giacomo

Petar Nedyalkov ha scritto:
This is not correct since you don't check the ranges of the day digits, month 
digits, etc.
The easiest way to check the string is to explode it by " " (space), then 
explode the first part by slash and the second by column, and at last check 
the ranges.

A regular expression will be much more complex.


I know, but I would need of a regular expression...=(

Giacomo

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



RE: [PHP-DB] Cannot connect to MySQL using

2006-03-30 Thread Nur_Adman
Thanks so much, Constantin...

 

Regards,

Anita

 

-Original Message-
From: Constantin Wolber [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 30, 2006 5:44 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Cannot connect to MySQL using

 

[EMAIL PROTECTED] wrote:

 

>Then change :

> 

>  127.0.0.1   localhost

> 

>become :

> 

>157.47.115.180  [my_server_name]

>  

> 

 

Changing this line is probably not the best way. This file is used for

resolving the hostnames ti ip adresses. So a better way would probably

be adding the line to the file. Since the entry for localhost should

remain in this file.

 

Greets Constantin

 

-- 

PHP Database Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php

 



Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Balazs Hegedus
Hi,

this regex isn't perfect at all but might do the job. You should
modify the pattern to match the year part against 2037 as a maximum
and also don't forget to checkdate().



Hope it helps,

Balazs

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



Re: [PHP-DB] [Regular expression] Format string to "DD/MM/YYYY hh:mm"

2006-03-30 Thread Balazs Hegedus
Oops, \s matches any whitespace character, so if you need only space
there you should change \s to space (this way it matches tab too).

Balazs

2006/3/31, Balazs Hegedus <[EMAIL PROTECTED]>:
> Hi,
>
> this regex isn't perfect at all but might do the job. You should
> modify the pattern to match the year part against 2037 as a maximum
> and also don't forget to checkdate().
>
> 
> $date = '30/03/2983 12:00';
> $pattern = '[0-3][0-9]/[0|1][0-9]/[1|2][0-9]{3,3}\s[0-2][0-9]:[0-5][0-9]';
> if (preg_match("!^$pattern$!", $date) === 1) {
> echo 'date is in valid form';
> }
> else {
> echo 'date form is invalid';
> }
>
> ?>
>
> Hope it helps,
>
> Balazs
>

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