php-general Digest 29 Oct 2007 23:33:11 -0000 Issue 5099

2007-10-29 Thread php-general-digest-help

php-general Digest 29 Oct 2007 23:33:11 - Issue 5099

Topics (messages 263771 through 263793):

Re: moving over to php 5
263771 by: Dave Goodchild
263778 by: Per Jessen
263782 by: Cristian Vrabie
263784 by: Philip Thompson
263785 by: Robert Cummings
263786 by: Robert Cummings
263788 by: Per Jessen
263793 by: Larry Garfield

Re: Newline
263772 by: Crayon Shin Chan
263774 by: Nathan Nobbe
263775 by: Jeremy Mcentire

what is the point of prepare?
263773 by: Hulf
263776 by: Per Jessen
263777 by: Jeremy Mcentire
263792 by: mlists

Re: sessions (version 5.1 to 5.2 )
263779 by: tedd

problem with bind_param
263780 by: Hulf
263790 by: Jeremy Mcentire

Re: returning an array from a function?
263781 by: Philip Thompson

unexpected '@' in preg_replace???
263783 by: Zoltán Németh
263787 by: Daniel Brown
263791 by: Jim Lucas

Re: SPL
263789 by: Jim Lucas

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
Support for php4 will be dropped at the end of the year so hosts will be
forced to make the upgrade at some point.

On 10/29/07, Hulf [EMAIL PROTECTED] wrote:

 Hi,


 It is about time I made the jump to 5, however the only thing that is
 holding me back is the problem with hosts. How many hosts still run php 4
 and am I going to have to spend hours and hours persuading them to upgrade
 before I can run my code?

 I have very little time as it is and am anxious that this is going to be
 swallowed up on the phone to hosing companies and their rubbish technical
 staff.

 Please let me know if I will find this an easy transition or should I hold
 off for now.


 R.

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


---End Message---
---BeginMessage---
Hulf wrote:

 It is about time I made the jump to 5, however the only thing that is
 holding me back is the problem with hosts. How many hosts still run
 php 4 and am I going to have to spend hours and hours persuading them
 to upgrade before I can run my code?

There are at least 117,223 hosting companies that are still using PHP4.
Unless they already have an upgrade project going, a single user is 
unlikely to convince them to start one. 

 Please let me know if I will find this an easy transition or should I
 hold off for now.

As a whole, I think you'll find the 4-5 transition easy.  Possible
issues:  the xsl extension, which was changed from saxon to libxml, and
the Mailparse extension also caused us some grief.  We rewrote the code
to use the new xsl stuff, and somehow we also managed to get Mailparse
installed.

Dave Goodchild wrote:

 Support for php4 will be dropped at the end of the year so hosts will
 be forced to make the upgrade at some point.

What will force them to do so?  Lack of support is unlikely to have any
effect.



/Per Jessen, Zürich
---End Message---
---BeginMessage---

Per Jessen wrote:

Hulf wrote:

  

It is about time I made the jump to 5, however the only thing that is
holding me back is the problem with hosts. How many hosts still run
php 4 and am I going to have to spend hours and hours persuading them
to upgrade before I can run my code?



There are at least 117,223 hosting companies that are still using PHP4.
Unless they already have an upgrade project going, a single user is 
unlikely to convince them to start one. 

  

Please let me know if I will find this an easy transition or should I
hold off for now.



As a whole, I think you'll find the 4-5 transition easy.  Possible
issues:  the xsl extension, which was changed from saxon to libxml, and
the Mailparse extension also caused us some grief.  We rewrote the code
to use the new xsl stuff, and somehow we also managed to get Mailparse
installed.

Dave Goodchild wrote:

  

Support for php4 will be dropped at the end of the year so hosts will
be forced to make the upgrade at some point.



What will force them to do so?  Lack of support is unlikely to have any
effect.



/Per Jessen, Zürich

  

Hmm 117,223 hosts with php4 only support. Did you actually checked how many 
have php5 support? Many more. You have hundreds of thousands of choices. And 
the pricing has quite leveled in the last period or the differences in price 
are absolutely minor. I don't see a reason to stay with one that only supports 
php4. After all, changing the adress-ip link on dns is free and it will 
propagate in a few hours.
---End Message---
---BeginMessage---
On 10/29/07, Per Jessen [EMAIL PROTECTED] wrote:

 Hulf wrote:

  It is about time I made the jump to 5, however the only thing that is
  holding me back is the 

[PHP] moving over to php 5

2007-10-29 Thread Hulf
Hi,


It is about time I made the jump to 5, however the only thing that is 
holding me back is the problem with hosts. How many hosts still run php 4 
and am I going to have to spend hours and hours persuading them to upgrade 
before I can run my code?

I have very little time as it is and am anxious that this is going to be 
swallowed up on the phone to hosing companies and their rubbish technical 
staff.

Please let me know if I will find this an easy transition or should I hold 
off for now.


R. 

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



Re: [PHP] moving over to php 5

2007-10-29 Thread Dave Goodchild
Support for php4 will be dropped at the end of the year so hosts will be
forced to make the upgrade at some point.

On 10/29/07, Hulf [EMAIL PROTECTED] wrote:

 Hi,


 It is about time I made the jump to 5, however the only thing that is
 holding me back is the problem with hosts. How many hosts still run php 4
 and am I going to have to spend hours and hours persuading them to upgrade
 before I can run my code?

 I have very little time as it is and am anxious that this is going to be
 swallowed up on the phone to hosing companies and their rubbish technical
 staff.

 Please let me know if I will find this an easy transition or should I hold
 off for now.


 R.

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




Re: [PHP] Newline

2007-10-29 Thread Crayon Shin Chan
On Sunday 28 October 2007, magoo wrote:

 I have switched to using single quotes, and found out that newline (\n)
 only works in double quotes. It looks kind of stupid using
 'someString'.\n; and it`s kind of inconsistent using double quotes
 for some lines like someString\n;.

You can:

define('LF', \n);

then

echo 'A newline' . LF;

or something

-- 
Crayon

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



[PHP] what is the point of prepare?

2007-10-29 Thread Hulf
Hi,

Begining using the php5 mysql functions and want to know what is the point of 
preparing/binding the data before I insert it?

$prep = $mysqli-prepare (INSERT INTO cd (cdid,title,artist) VALUES 
('0',?,?));
$prep-bind_param ('22',$title,$artist);

Ta,

R.


Re: [PHP] Newline

2007-10-29 Thread Nathan Nobbe
On 10/29/07, Crayon Shin Chan [EMAIL PROTECTED] wrote:

 On Sunday 28 October 2007, magoo wrote:

  I have switched to using single quotes, and found out that newline (\n)
  only works in double quotes. It looks kind of stupid using
  'someString'.\n; and it`s kind of inconsistent using double quotes
  for some lines like someString\n;.

 You can:

 define('LF', \n);

 then

 echo 'A newline' . LF;

 or something


if you were going to do that you may as well use PHP_EOL
its cross-platform and doesnt require an define directive.
(php5 only)

-nathan


Re: [PHP] Newline

2007-10-29 Thread Jeremy Mcentire
In general, I try to think of single quotes as being literal and  
double quotes as being interpreted.


In that case, we expect 'some line\t with a tab, a variable {$obj- 
member}, and a newline\n' to produce exactly:

some line\t with a tab, a variable {$obj-member}, and a newline\n

Yet, the same thing in double quotes:
some linewith a tab, a variable foo, and a
 newline

As a result, I use single quotes whenever I can.  Otherwise, double.

Jeremy Mcentire
Ant Farmer
ZooToo LLC


On Oct 29, 2007, at 6:15 AM, Nathan Nobbe wrote:


On 10/29/07, Crayon Shin Chan [EMAIL PROTECTED] wrote:


On Sunday 28 October 2007, magoo wrote:

I have switched to using single quotes, and found out that  
newline (\n)

only works in double quotes. It looks kind of stupid using
'someString'.\n; and it`s kind of inconsistent using double quotes
for some lines like someString\n;.


You can:

define('LF', \n);

then

echo 'A newline' . LF;

or something



if you were going to do that you may as well use PHP_EOL
its cross-platform and doesnt require an define directive.
(php5 only)

-nathan


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



Re: [PHP] what is the point of prepare?

2007-10-29 Thread Per Jessen
Hulf wrote:

 Begining using the php5 mysql functions and want to know what is the
 point of preparing/binding the data before I insert it?
 
 $prep = $mysqli-prepare (INSERT INTO cd (cdid,title,artist) VALUES
 ('0',?,?)); $prep-bind_param ('22',$title,$artist);

It's a performance measure - by preparing sql statements, you save on
the parsing and the network traffic.  Unless you're doing lots of
database transactions per second, I doubt if you'll notice it.



/Per Jessen, Zürich

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



Re: [PHP] what is the point of prepare?

2007-10-29 Thread Jeremy Mcentire
If you're making just one insert; it's probably not the best  
approach.  However, if you're inserting multiple rows, benchmarks  
have shown that preparing a statement and binding the params is  
faster.  Also, with mysqli, you can strictly define types for fields  
and remove the step of validation -- so they say.  I'd rather not try 
{} catch{} a query and give an error on failure... so, I prepare the  
data as I test its validity anyway.


Jeremy Mcentire
Ant Farmer
ZooToo LLC


On Oct 29, 2007, at 6:06 AM, Hulf wrote:


Hi,

Begining using the php5 mysql functions and want to know what is  
the point of preparing/binding the data before I insert it?


$prep = $mysqli-prepare (INSERT INTO cd (cdid,title,artist)  
VALUES ('0',?,?));

$prep-bind_param ('22',$title,$artist);

Ta,

R.


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



Re: [PHP] moving over to php 5

2007-10-29 Thread Per Jessen
Hulf wrote:

 It is about time I made the jump to 5, however the only thing that is
 holding me back is the problem with hosts. How many hosts still run
 php 4 and am I going to have to spend hours and hours persuading them
 to upgrade before I can run my code?

There are at least 117,223 hosting companies that are still using PHP4.
Unless they already have an upgrade project going, a single user is 
unlikely to convince them to start one. 

 Please let me know if I will find this an easy transition or should I
 hold off for now.

As a whole, I think you'll find the 4-5 transition easy.  Possible
issues:  the xsl extension, which was changed from saxon to libxml, and
the Mailparse extension also caused us some grief.  We rewrote the code
to use the new xsl stuff, and somehow we also managed to get Mailparse
installed.

Dave Goodchild wrote:

 Support for php4 will be dropped at the end of the year so hosts will
 be forced to make the upgrade at some point.

What will force them to do so?  Lack of support is unlikely to have any
effect.



/Per Jessen, Zürich

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



Re: [PHP] sessions (version 5.1 to 5.2 )

2007-10-29 Thread tedd

strange.  i must be missing something simple.


Fritz


I would guess that you did make the first line of your code:

?php session_start();

http://www.php.net/session_start

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] problem with bind_param

2007-10-29 Thread Hulf
Hi,

I am still having poblems with the php5 functions. I have 4 variables in 
each. What is the problem?


Warning: mysqli_stmt::bind_param() [function.mysqli-stmt-bind-param]: Number 
of elements in type definition string doesn't match number of bind variables 
in  on line 21

$prep = $mysqli-prepare (UPDATE events SET title=?, date=?, content=?, 
imageUrl=?);
$prep-bind_param ( $_POST['title'], $_POST['date'], $_POST['content'], 
$_POST['imageUrl']);

thanks,

H. 

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



Re: [PHP] returning an array from a function?

2007-10-29 Thread Philip Thompson
On 10/26/07, tedd [EMAIL PROTECTED] wrote:

 Rob:

 Why use a global?

 Plus, your function is returning an array, but you're not catching it.

 $mve_array = convert( $latitude, $longitude );

 Example:

 http://www.webbytedd.com/bbb/array-function/

 Cheers,

 tedd


So... do you write some of these pages on-the-fly when you see someone
needing assistance from the list? or you have this repository of scripts? =D

~Philip


Re: [PHP] moving over to php 5

2007-10-29 Thread Cristian Vrabie

Per Jessen wrote:

Hulf wrote:

  

It is about time I made the jump to 5, however the only thing that is
holding me back is the problem with hosts. How many hosts still run
php 4 and am I going to have to spend hours and hours persuading them
to upgrade before I can run my code?



There are at least 117,223 hosting companies that are still using PHP4.
Unless they already have an upgrade project going, a single user is 
unlikely to convince them to start one. 

  

Please let me know if I will find this an easy transition or should I
hold off for now.



As a whole, I think you'll find the 4-5 transition easy.  Possible
issues:  the xsl extension, which was changed from saxon to libxml, and
the Mailparse extension also caused us some grief.  We rewrote the code
to use the new xsl stuff, and somehow we also managed to get Mailparse
installed.

Dave Goodchild wrote:

  

Support for php4 will be dropped at the end of the year so hosts will
be forced to make the upgrade at some point.



What will force them to do so?  Lack of support is unlikely to have any
effect.



/Per Jessen, Zürich

  

Hmm 117,223 hosts with php4 only support. Did you actually checked how many 
have php5 support? Many more. You have hundreds of thousands of choices. And 
the pricing has quite leveled in the last period or the differences in price 
are absolutely minor. I don't see a reason to stay with one that only supports 
php4. After all, changing the adress-ip link on dns is free and it will 
propagate in a few hours.

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



[PHP] unexpected '@' in preg_replace???

2007-10-29 Thread Zoltán Németh
hi list,

I have this code:

?php

$mit = array(
 /\r/,  // Non-legal carriage 
return
 /[\n\t]+/, // Newlines and tabs
 '/[ ]{2,}/', // Runs of spaces, 
pre-handling
 '/script[^]*.*?\/script/i', // scripts -- which 
strip_tags supposedly has problems with
 '/style[^]*.*?\/style/i',   // styles -- which 
strip_tags supposedly has problems with
 '/h[123][^]*(.*?)\/h[123]/ie',  // H1 - H3
 '/h[456][^]*(.*?)\/h[456]/ie',  // H4 - H6
 '/p[^]*/i',   // P
 '/br[^]*/i',  // br
 '/b[^]*(.*?)\/b/ie',// b
 '/strong[^]*(.*?)\/strong/ie',  // strong
 '/i[^]*(.*?)\/i/i', // i
 '/em[^]*(.*?)\/em/i',   // em
 '/(ul[^]*|\/ul)/i', // ul and /ul
 '/(ol[^]*|\/ol)/i', // ol and /ol
 '/li[^]*(.*?)\/li/i',   // li and /li
 '/li[^]*/i',  // li
 '/a [^]*href=([^]+)[^]*(.*?)\/a/ie',
  // a href=
 '/hr[^]*/i',  // hr
 '/(table[^]*|\/table)/i',   // table and
/table
 '/(tr[^]*|\/tr)/i', // tr and /tr
 '/td[^]*(.*?)\/td/i',   // td and /td
 '/th[^]*(.*?)\/th/ie',  // th and /th
 '/(nbsp|#160);/i',  // Non-breaking space
 '/(quot|rdquo|ldquo|#8220|#8221|#147|#148);/i',
  // Double quotes
 '/(apos|rsquo|lsquo|#8216|#8217);/i',   // Single quotes
 '/gt;/i',   // Greater-than
 '/lt;/i',   // Less-than
 '/(amp|#38);/i',// Ampersand
 '/(copy|#169);/i',  // Copyright
 '/(trade|#8482|#153);/i',   // Trademark
 '/(reg|#174);/i',   // Registered
 '/(mdash|#151|#8212);/i',   // mdash
 '/(ndash|minus|#8211|#8722);/i',// ndash
 '/(bull|#149|#8226);/i',// Bullet
 '/(pound|#163);/i', // Pound sign
 '/(euro|#8364);/i', // Euro sign
 '/[^;]+;/i',   // Unknown/unhandled 
entities
 '/[ ]{2,}/'  // Runs of spaces, 
post-handling
 );

$mire = array(
 '', // Non-legal carriage 
return
 ' ',// Newlines and tabs
 ' ',// Runs of spaces, 
pre-handling
 '', // scripts -- which 
strip_tags supposedly has problems with
 '', // styles -- which 
strip_tags supposedly has problems with
 strtoupper(\\n\n\\1\n\n\),  // H1 - H3
 ucwords(\\n\n\\1\n\n\), // H4 - H6
 \n\n\t,   // P
 \n,   // br
 '_\\1_',// b
 '_\\1_',// strong
 '_\\1_',// i
 '_\\1_',// em
 \n\n, // ul and /ul
 \n\n, // ol and /ol
 \t* \\1\n,// li and /li
 \n\t* ,   // li
 '$this-_build_link_list(\\1, \\2)',
 // a href=
 \n-\n,// hr
 \n\n, // table and /table
 \n,   // tr and /tr
 \t\t\\1\n,// td and /td
 strtoupper(\\t\t\\1\n\),// th and /th
 ' ',// Non-breaking space
 '',// Double quotes
 ',// Single quotes
 '',
 '',
 '',
 '(c)',
 '(tm)',
 '(R)',
 '--',
 '-',
 '*',
 '£',
 'EUR',  // Euro sign. € ?
 '', // Unknown/unhandled 
entities
 ' ' // Runs of spaces, 
post-handling
 );

$dokumentum = EOF
pzoltan.strong[EMAIL PROTECTED]/strong/ppstrongzoltan.nem[EMAIL 
PROTECTED]/em/strongemeonerelo.com/em/ppem[EMAIL 
PROTECTED]/emeonerelo.com/pp[EMAIL PROTECTED]nbsp;/p
EOF;

$szoveg = preg_replace 

Re: [PHP] moving over to php 5

2007-10-29 Thread Philip Thompson
On 10/29/07, Per Jessen [EMAIL PROTECTED] wrote:

 Hulf wrote:

  It is about time I made the jump to 5, however the only thing that is
  holding me back is the problem with hosts. How many hosts still run
  php 4 and am I going to have to spend hours and hours persuading them
  to upgrade before I can run my code?

 There are at least 117,223 hosting companies that are still using PHP4.
 Unless they already have an upgrade project going, a single user is
 unlikely to convince them to start one.

  Please let me know if I will find this an easy transition or should I
  hold off for now.

 As a whole, I think you'll find the 4-5 transition easy.  Possible
 issues:  the xsl extension, which was changed from saxon to libxml, and
 the Mailparse extension also caused us some grief.  We rewrote the code
 to use the new xsl stuff, and somehow we also managed to get Mailparse
 installed.

 Dave Goodchild wrote:

  Support for php4 will be dropped at the end of the year so hosts will
  be forced to make the upgrade at some point.

 What will force them to do so?  Lack of support is unlikely to have any
 effect.


 /Per Jessen, Zürich



 I think the real question is will listservs (like this one) stop
supporting people running applications on PHP4 in 98 days (
http://gophp5.org/)? I'm not saying we should outcast *those people* who
haven't transitioned, but will the process speed up if a community puts
their foot down? Is this how it will be..

[example question]
I'm running PHP4 and blah blah blah...

[example response]
Oh, I noticed you said PHP4. Sorry, upgrade, then we'll support...

Just a thought...
~Philip


Re: [PHP] moving over to php 5

2007-10-29 Thread Robert Cummings
On Mon, 2007-10-29 at 08:52 +, Hulf wrote:
 Hi,
 
 
 It is about time I made the jump to 5, however the only thing that is 
 holding me back is the problem with hosts. How many hosts still run php 4 
 and am I going to have to spend hours and hours persuading them to upgrade 
 before I can run my code?
 
 I have very little time as it is and am anxious that this is going to be 
 swallowed up on the phone to hosing companies and their rubbish technical 
 staff.
 
 Please let me know if I will find this an easy transition or should I hold 
 off for now.

Update your code so it works for both PHP4 and PHP5. Then you can
actually make the move whenever you please regardless of what hosting
companies are offering.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] moving over to php 5

2007-10-29 Thread Robert Cummings
On Mon, 2007-10-29 at 09:42 -0500, Philip Thompson wrote:

  I think the real question is will listservs (like this one) stop
 supporting people running applications on PHP4 in 98 days (
 http://gophp5.org/)? I'm not saying we should outcast *those people* who
 haven't transitioned, but will the process speed up if a community puts
 their foot down? Is this how it will be..
 
 [example question]
 I'm running PHP4 and blah blah blah...
 
 [example response]
 Oh, I noticed you said PHP4. Sorry, upgrade, then we'll support...

Won't hear me making that statement. But then I'm not a snob to PHP4 :)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] unexpected '@' in preg_replace???

2007-10-29 Thread Daniel Brown
On 10/29/07, Zoltán Németh [EMAIL PROTECTED] wrote:
 hi list,

 I have this code:
[snip!]
 Parse error: syntax error, unexpected '@'
 in /home/znemeth/public_html/test/pregreplacetest1.php(94) : regexp code
 on line 1

 Fatal error: preg_replace() [a
 href='function.preg-replace'function.preg-replace/a]: Failed
 evaluating code: [EMAIL PROTECTED]
 in /home/znemeth/public_html/test/pregreplacetest1.php on line 94
[snip=again!]

Zoltan,

If you're using preg_replace(), where are your start and stop
characters for the pattern and subject?

$szoveg = preg_replace('/'.$mit.'/','/'.$mire.'/',$dokumentum);

You could otherwise try ereg_replace(); without the slashes, or do
an htmlentities($dokumentum);.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished

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



Re: [PHP] moving over to php 5

2007-10-29 Thread Per Jessen
Cristian Vrabie wrote:

 Hmm 117,223 hosts with php4 only support. Did you actually checked how
 many have php5 support? Many more. 

There are 178.112 hosters that have PHP5 support.  I checked. 

 You have hundreds of thousands of choices. And the pricing has quite
 leveled in the last period or the differences in price are absolutely
 minor. I don't see a reason to stay with one that only supports php4.

Nobody suggested that you do - especially if you need PHP5.  If however
you don't have a specific requirement for PHP5, why would you move? 


/Per Jessen, Zürich

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



Re: [PHP] SPL

2007-10-29 Thread Jim Lucas

Børge Holen wrote:

On Sunday 28 October 2007 07:27:53 you wrote:

Børge Holen wrote:

I found this code at php.net witch needs very little modifications and
can do so much, but I can't figure out how to make it read alphabeticly
as mentioned

$it = new RecursiveDirectoryIterator($_GET['location']);
foreach (new RecursiveIteratorIterator($it, 2) as $path){
if($path-isDir()){
// writing to some static file
}elseif(some unfinished statement){
fwrite($dynfile, $path\n);
}else{
// writing to some static file
}
}

I just... nothings keeping me from sorting the the dynfile after writing,
but also that seems to do the job twice instead of doing it correct the
first time.


-nathan

I am trying to figure out what you are trying to do here.


The code is for recursiving directory structure.
Starting at a given location





Ok, so, let me get this straight.

You want the ability to display alphabetically, the files/directories of a given directory and all 
sub-directories?


Now, do you want this echo'ed to the screen, or saved in a file like you did in 
your earlier example?

either way, the following code will help you I think.

?php

function displayDirectory($path) {
$data = glob($path.'/*');
foreach ( $data AS $entry ) {
if ( in_array($entry, array('./', '../')) ) {
continue;
}
if ( is_dir($entry) ) {
displayDirectory($entry);
} else {
echo {$entry}\n;
}
}
}

displayDirectory($_GET['location']);


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] problem with bind_param

2007-10-29 Thread Jeremy Mcentire

The PHP docs show:

$stmt = $mysqli-prepare(INSERT INTO CountryLanguage VALUES  
(?, ?, ?, ?));

$stmt-bind_param('sssd', $code, $language, $official, $percent);

for usage.  Your $prep-bind_param() doesn't seem to include the  
definitions. 'sssd' in the above example, string, string, string,  
decimal.  Further, you should probably make sure that your $_POST  
data is set and isn't null or a variable type other than what is  
expected.


Jeremy Mcentire
Ant Farmer
ZooToo LLC


On Oct 29, 2007, at 9:51 AM, Hulf wrote:


Hi,

I am still having poblems with the php5 functions. I have 4  
variables in

each. What is the problem?


Warning: mysqli_stmt::bind_param() [function.mysqli-stmt-bind- 
param]: Number
of elements in type definition string doesn't match number of bind  
variables

in  on line 21

$prep = $mysqli-prepare (UPDATE events SET title=?, date=?,  
content=?,

imageUrl=?);
$prep-bind_param ( $_POST['title'], $_POST['date'], $_POST 
['content'],

$_POST['imageUrl']);

thanks,

H.

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



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



Re: [PHP] unexpected '@' in preg_replace???

2007-10-29 Thread Jim Lucas

Daniel Brown wrote:

On 10/29/07, Zoltán Németh [EMAIL PROTECTED] wrote:

hi list,

I have this code:

[snip!]

Parse error: syntax error, unexpected '@'
in /home/znemeth/public_html/test/pregreplacetest1.php(94) : regexp code
on line 1

Fatal error: preg_replace() [a
href='function.preg-replace'function.preg-replace/a]: Failed
evaluating code: [EMAIL PROTECTED]
in /home/znemeth/public_html/test/pregreplacetest1.php on line 94

[snip=again!]

Zoltan,

If you're using preg_replace(), where are your start and stop
characters for the pattern and subject?

$szoveg = preg_replace('/'.$mit.'/','/'.$mire.'/',$dokumentum);

You could otherwise try ereg_replace(); without the slashes, or do
an htmlentities($dokumentum);.



Look again and you will notice that $mit and $mire are both arrays.

Also, the starting and stopping points are in the $mit array elements.

The starting and stopping points are not allowed in the $mire array.

This was the offending line in the code.  I removed the e from the modifiers list and it started 
working.  See if you can run the code without it.


 '/strong[^]*(.*?)\/strong/i',  // strong


you missed your closing option
 '/\/?p[^]*/i',   // P

or maybe you should have a different entry to remove the /p and replace it 
with nothing.
this
 '/p[^]*/i',   // P
that
 \n\n\t,

this
 '/\/p[^]*/i',   // /P
that
 '',

Side note, you might want to look into using the '+' instead of the '*'.
'+' = must be one or more
'*' = 0 or more

In some of the cases here, I see where this can bite you in the butt later.


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] what is the point of prepare?

2007-10-29 Thread mlists
On Mon, 2007-10-29 at 10:06 +, Hulf wrote:
 Hi,
 
 Begining using the php5 mysql functions and want to know what is the point of 
 preparing/binding the data before I insert it?
 
 $prep = $mysqli-prepare (INSERT INTO cd (cdid,title,artist) VALUES 
 ('0',?,?));
 $prep-bind_param ('22',$title,$artist);
 
 Ta,
 
 R.

With a prepared statement, you can use mysqli_get_metadata() to get
information about the columns of the result that statement will
generate, without having to actually execute the statement (or parse it
yourself).

This comes in really handy if you have dynamically generated SQL and
need to know what the names/types of the columns are going to be before
you execute it.

Mysqli_get_metadata() also includes info on the original names and
tables of the columns (if they have been aliased) and what their types
are.  This is great for generating multi-table insert statements from
dynamically generated SQL queries.

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



Re: [PHP] moving over to php 5

2007-10-29 Thread Larry Garfield
On Monday 29 October 2007, Per Jessen wrote:
 Cristian Vrabie wrote:
  Hmm 117,223 hosts with php4 only support. Did you actually checked how
  many have php5 support? Many more.

 There are 178.112 hosters that have PHP5 support.  I checked.

Where and how did you check?  Compiling such stats is rather hit or miss, and 
the numbers most people quoted until now I have decided are simply wrong.

I have a hard time believing that there are 300,000 different commercial web 
hosting companies out there.  That many servers, sure, but companies?

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] moving over to php 5

2007-10-29 Thread Larry Garfield
On Monday 29 October 2007, Philip Thompson wrote:

  I think the real question is will listservs (like this one) stop
 supporting people running applications on PHP4 in 98 days (
 http://gophp5.org/)? I'm not saying we should outcast *those people* who
 haven't transitioned, but will the process speed up if a community puts
 their foot down? Is this how it will be..

 [example question]
 I'm running PHP4 and blah blah blah...

 [example response]
 Oh, I noticed you said PHP4. Sorry, upgrade, then we'll support...

 Just a thought...
 ~Philip

Did you see the mega thread that started from someone asking about PHP 4 
classes? :-)

Personally I've already written off PHP 4 support, and assume that people have 
PHP 5.  I have access to only one box that is older than PHP 5.2.0, and 
that's a 5.1.6 box.  

Here's a bigger question: When will people stop using mysql_ as their example 
API, when PDO is more standard in PHP 5 and more secure, and mysqli is 
available as well?

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] Configuring 5.2.4 for Mac OSX and Webstar

2007-10-29 Thread Steve Meredith
I'm having difficulty compiling and upgrading to version 5.2.4. Also using
WebSTAR.
Here's the steps I took and the resulting errors.

Any help would be appreciated!

1. Download the latest copy of PHP source code from [ http://www.php.net/
]http://www.php.net 
2. Open the Terminal application (in Applications/Utilities).
3. Type in cd  and then drag the PHP source folder from the Finder to the
Terminal.
4. Click back in the Terminal and hit return. This should put you in the PHP
source folder.
5. Type in ./configure and hit return. If you get a command unknown
error, type in sudo chmod a+rx configure and retry. Wait for the script to
complete.
6. Type in make and hit return/enter. Wait for the compile to complete.

Results, no compiled php to copy to!

Last login: Sat Oct 20 15:58:53 on console
Welcome to Darwin!
steve-merediths-powerbook-g4-17:~ stevemeredith$ cd
/Users/stevemeredith/Desktop/php-5.2.4/ 
steve-merediths-powerbook-g4-17:~/Desktop/php-5.2.4 stevemeredith$ ./configure
creating cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for egrep... grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking host system type... powerpc-apple-darwin8.10.0
checking target system type... powerpc-apple-darwin8.10.0
checking for gcc... no
checking for cc... no
configure: error: no acceptable cc found in $PATH
steve-merediths-powerbook-g4-17:~/Desktop/php-5.2.4 stevemeredith$ make
-bash: make: command not found
steve-merediths-powerbook-g4-17:~/Desktop/php-5.2.4 stevemeredith$ 







Steve Meredith
Internet Services Bureau Chief
Montana Office of Public Instruction
www.opi.mt.gov
www.metnet.mt.gov
MathScience.mt.gov
406-444-3563



Re: [PHP] Newline

2007-10-29 Thread Crayon Shin Chan
On Monday 29 October 2007, Nathan Nobbe wrote:
 if you were going to do that you may as well use PHP_EOL
 its cross-platform and doesnt require an define directive.
 (php5 only)

It's available in 4.3.10 as well, but manual doesn't specify what it 
defines - I suppose I can echo or vardump it to find out. Also manual 
doesn't mention cross-platform, in any case even if it 
is cross-platform it seems pointless because how does PHP know which 
environment the output is going to be used in? I 
define 'CR', 'LF', 'CRLF' and use them as circumstances dictate.

-- 
Crayon

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



Re: [PHP] Newline

2007-10-29 Thread Nathan Nobbe
On 10/30/07, Crayon Shin Chan [EMAIL PROTECTED] wrote:

 On Monday 29 October 2007, Nathan Nobbe wrote:
  if you were going to do that you may as well use PHP_EOL
  its cross-platform and doesnt require an define directive.
  (php5 only)

 It's available in 4.3.10 as well,


youre right about that; my mistake.

but manual doesn't specify what it
 defines -


let the source tell it:
phpunpack/php5.2-200708051230/NEWS:2867:- Added PHP_EOL constant that
contains the OS way of representing newlines.

 47 #ifdef PHP_WIN32
 48 #include tsrm_win32.h
 49 #include win95nt.h
 50 #   ifdef PHP_EXPORTS
 51 #   define PHPAPI __declspec(dllexport)
 52 #   else
 53 #   define PHPAPI __declspec(dllimport)
 54 #   endif
 55 #define PHP_DIR_SEPARATOR '\\'
 56 #define PHP_EOL \r\n
 57 #else
 58 #define PHPAPI
 59 #define THREAD_LS
 60 #define PHP_DIR_SEPARATOR '/'
 61 #if defined(__MacOSX__)
 62 #define PHP_EOL \r
 63 #else
 64 #define PHP_EOL \n
 65 #endif
 66 #endif

I suppose I can echo or vardump it to find out.


a little trickier than you might guess :

php  var_dump(PHP_EOL);
string(1) 


Also manual
 doesn't mention cross-platform, in any case even if it
 is cross-platform it seems pointless because how does PHP know which
 environment the output is going to be used in?


its supposed to be used for the command line;
theoretically the output will land on the same system from which its
generated.
however, coming from my linux box; this was correctly interpreted by
internet explorer
?php
echo 'blah' . PHP_EOL . 'blah';
?
result when viewing source was
blah
blah

I define 'CR', 'LF', 'CRLF' and use them as circumstances dictate.


the use of that definitely depends upon the circumstances; ill stick w/ the
predefined constant until i run into a problem ;)

-nathan