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

[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(). -- ---

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

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

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

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 :

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(). ?php $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]';

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