Re: [PHP] pcre little problem

2011-11-08 Thread tamouse mailing lists
On Mon, Nov 7, 2011 at 5:54 AM, Richard Quadling rquadl...@gmail.com wrote:
 On 4 November 2011 16:52, QI.VOLMAR QI qi.vol...@gmail.com wrote:

 i have this part of code that works with DOMDocument:

 public function translateNFeXML(NFE $nfe_factory) {
        $inf_adic = $nfe_factory-createElement('infAdic');
        if ($this-inf_ad_fisco) {
            $inf_adic_fisco =
 $nfe_factory-createElement('infAdicFisco', $this-inf_ad_fisco);
            $inf_adic-appendChild($inf_adic_fisco);
        }

        $string = a=10b[]=20c=30n°d=40+:50;
        die(preg_filter('/[^:][[:punct:]]/', '', $string));
        $inf_cpl = $nfe_factory-createElement('infCpl',
 $this-inf_complementar);

 QUESTION: Why the preg_filter causes a end of the application, with no
 error throwing (even in die don't appears nothing)?


 preg_filter() returns NULL if there are no matches and the subject is a
 string.

 And ...

 php -r die(null);

 outputs nothing.


Here:

        die(preg_filter('/[^:][[:punct:]]/', '', $string));

Did you really want to do this:

preg_filter('/[^:][[:punct:]]/', '', $string) or die(nothing returned\n);

???

See http://php.net/manual/en/function.preg-filter.php Return values
as Richard points out preg_filter returns NULL if there are no matched
in a string.

Now this is interesting:

        $string = a=10b[]=20c=30n°d=40+:50;

There is a wide character in that string following 30n. The preg
functions sometimes don't deal well with wide characters in my
experience (it's not 100% anyway), you probably need to use the mb_
functions instead.

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



Re: [PHP] pcre little problem

2011-11-08 Thread QI.VOLMAR QI
I've got with preg_replace(). But I guess that filter_var could be used
instead.
Em 08/11/2011 08:46, tamouse mailing lists tamouse.li...@gmail.com
escreveu:

 On Mon, Nov 7, 2011 at 5:54 AM, Richard Quadling rquadl...@gmail.com
 wrote:
  On 4 November 2011 16:52, QI.VOLMAR QI qi.vol...@gmail.com wrote:
 
  i have this part of code that works with DOMDocument:
 
  public function translateNFeXML(NFE $nfe_factory) {
 $inf_adic = $nfe_factory-createElement('infAdic');
 if ($this-inf_ad_fisco) {
 $inf_adic_fisco =
  $nfe_factory-createElement('infAdicFisco', $this-inf_ad_fisco);
 $inf_adic-appendChild($inf_adic_fisco);
 }
 
 $string = a=10b[]=20c=30n°d=40+:50;
 die(preg_filter('/[^:][[:punct:]]/', '', $string));
 $inf_cpl = $nfe_factory-createElement('infCpl',
  $this-inf_complementar);
 
  QUESTION: Why the preg_filter causes a end of the application, with no
  error throwing (even in die don't appears nothing)?
 
 
  preg_filter() returns NULL if there are no matches and the subject is a
  string.
 
  And ...
 
  php -r die(null);
 
  outputs nothing.


 Here:

 die(preg_filter('/[^:][[:punct:]]/', '', $string));

 Did you really want to do this:

 preg_filter('/[^:][[:punct:]]/', '', $string) or die(nothing returned\n);

 ???

 See http://php.net/manual/en/function.preg-filter.php Return values
 as Richard points out preg_filter returns NULL if there are no matched
 in a string.

 Now this is interesting:

 $string = a=10b[]=20c=30n°d=40+:50;

 There is a wide character in that string following 30n. The preg
 functions sometimes don't deal well with wide characters in my
 experience (it's not 100% anyway), you probably need to use the mb_
 functions instead.



Re: [PHP] pcre little problem

2011-11-07 Thread Richard Quadling
On 4 November 2011 16:52, QI.VOLMAR QI qi.vol...@gmail.com wrote:

 i have this part of code that works with DOMDocument:

 public function translateNFeXML(NFE $nfe_factory) {
$inf_adic = $nfe_factory-createElement('infAdic');
if ($this-inf_ad_fisco) {
$inf_adic_fisco =
 $nfe_factory-createElement('infAdicFisco', $this-inf_ad_fisco);
$inf_adic-appendChild($inf_adic_fisco);
}

$string = a=10b[]=20c=30n°d=40+:50;
die(preg_filter('/[^:][[:punct:]]/', '', $string));
$inf_cpl = $nfe_factory-createElement('infCpl',
 $this-inf_complementar);

 QUESTION: Why the preg_filter causes a end of the application, with no
 error throwing (even in die don't appears nothing)?


preg_filter() returns NULL if there are no matches and the subject is a
string.

And ...

php -r die(null);

outputs nothing.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370


[PHP] pcre little problem

2011-11-04 Thread QI.VOLMAR QI
i have this part of code that works with DOMDocument:

public function translateNFeXML(NFE $nfe_factory) {
$inf_adic = $nfe_factory-createElement('infAdic');
if ($this-inf_ad_fisco) {
$inf_adic_fisco =
$nfe_factory-createElement('infAdicFisco', $this-inf_ad_fisco);
$inf_adic-appendChild($inf_adic_fisco);
}

$string = a=10b[]=20c=30n°d=40+:50;
die(preg_filter('/[^:][[:punct:]]/', '', $string));
$inf_cpl = $nfe_factory-createElement('infCpl',
$this-inf_complementar);

QUESTION: Why the preg_filter causes a end of the application, with no
error throwing (even in die don't appears nothing)?

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



[PHP] Re: Little Problem with my Guestbook

2005-09-14 Thread David Robley
Florian Paucke wrote:

 Hi.
 
 I'm new to PHP.
 
 I need some help from you, because, I'm creating a
 guestbook. But I have a little problem.
 
 I have a table, where the different My-SQL-Entries
 are read out.
 But now I get only one Entry, but not more.
 
 How can do it, that the table read out 4 times, when
 4 entries are in the database?
 
 And the cursor from the database are jumping to
 the next entry.
 
 Sorry for my bad english. :)

Assuming you are using a SELECT statement that returns more than one row,
you need to loop through the rows that are returned by your query. Have a
look at the examples for mysql_fetch_array in the php docs at
php.net/mysql_fetch_array The examples show the entire process from the
SELECT statement through to printing the results with printf.

You may find printf a bit daunting; echo might be easier for a beginner
unless you are used to C. To use echo, in example 3 replace

printf(ID: %s  Name: %s, $row[id], $row[name]);

with

echo ID: {$row[id]} Name: {$row[name]};

Cheers
-- 
David Robley

I Never Knew A Cat Who Suffered From Insomnia.

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



[PHP] stupid little problem

2001-11-16 Thread Michiel van Heusden

sorry..I'm quite new in this php-stuff
i've got a little problem

if I write

a$ = test;
b$ = test2;
data$ .= a$ . . b$   ;
echo data$;

it outputs:
test test2
instead of:
test   test2  

I really need that spaces..
any help?
thnx



-- 
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]




RE: [PHP] stupid little problem

2001-11-16 Thread Christoph Starkmann

Hi!

 a$ = test;
 b$ = test2;
 data$ .= a$ . . b$   ;
 echo data$;
 
 it outputs:
 test test2
 instead of:
 test   test2  
 
 I really need that spaces..
 any help?

HTML is normalizing all text; So any number of spaces, tabs newlines etc.
become one space  ;

If you want a certain number of spaces, you could use the nbsp;-entity:

$a = test;
$b = test2;
$data = $a . nbsp;nbsp;nbsp;nbsp; . $b . nbsp;nbsp;nbsp;nbsp;;

echo $data;

Greets,

Kiko

-
It's not a bug, it's a feature.

[.nfq]

christoph starkmann

tel.: 0821 / 56 97 94 34
fax.: 0821 / 56 97 94 38

http://www.fh-augsburg.de/~kiko

ICQ: 100601600
-

-- 
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]




Re: [PHP] stupid little problem

2001-11-16 Thread Richard Baskett

In html anything more than one space will be represented as only one space,
so to overcome that you'll need to use nbsp; which is a non-breaking space.
To get three spaces in between a word you would do:

word1 nbsp; word2

and there will be exactly three spaces in between.  I hope that helps!

Rick

 sorry..I'm quite new in this php-stuff
 i've got a little problem
 
 if I write
 
 a$ = test;
 b$ = test2;
 data$ .= a$ . . b$   ;
 echo data$;
 
 it outputs:
 test test2
 instead of:
 test   test2  
 
 I really need that spaces..
 any help?
 thnx
 
 
 
 -- 
 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]




Re: [PHP] stupid little problem

2001-11-16 Thread Andrey Hristov

Use the pre tag before the input, and /pre after it.

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS


- Original Message - 
From: Michiel van Heusden [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 16, 2001 2:30 PM
Subject: [PHP] stupid little problem


 sorry..I'm quite new in this php-stuff
 i've got a little problem
 
 if I write
 
 a$ = test;
 b$ = test2;
 data$ .= a$ . . b$   ;
 echo data$;
 
 it outputs:
 test test2
 instead of:
 test   test2  
 
 I really need that spaces..
 any help?
 thnx
 
 
 
 -- 
 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]




[PHP] oops, little problem with mysql

2001-01-22 Thread Dominick Vansevenant

Hello,

I deleted all the records from the privileges tables (mysql database) and
restarted the daemon.

Now off course I cannot access the databases, what can I do?

D.



-- 
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]




Re: [PHP] oops, little problem with mysql

2001-01-22 Thread Kath

Do you still have r00t access to the database?

- Kath

- Original Message - 
From: "Dominick Vansevenant" [EMAIL PROTECTED]
To: "Php-General" [EMAIL PROTECTED]
Sent: Monday, January 22, 2001 9:05 AM
Subject: [PHP] oops, little problem with mysql


 Hello,
 
 I deleted all the records from the privileges tables (mysql database) and
 restarted the daemon.
 
 Now off course I cannot access the databases, what can I do?
 
 D.
 
 
 
 -- 
 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]




[PHP] A little problem

2001-01-17 Thread Emiliano Marmonti

Hello all

 I have a little problem: Sometimes when you invokes some .php page, appears "could 
not redefine function...". It looks like a Web server problem because If you try again 
one or two times, the same operation works Ok. Im using PHP 4, Win 98 SR2, PWS and 
MySql for Windows.

Thanks.

Emiliano Marmonti




Re: [PHP] A little problem

2001-01-17 Thread Brian Clark


Hello Emiliano, 

(EM == "Emiliano Marmonti") [EMAIL PROTECTED] writes:

EM I have a little problem: Sometimes when you invokes some .php
EM page, appears "could not redefine function...". It looks like a

Try:

?php

if(! defined('__FOO__')):
   define('__FOO__', 1);

   /* functions */

endif;

?

-Brian
--
You may be recognized soon. Hide.



-- 
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]