|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 29 Nov 2003 06:13:58 -0000 Issue 2443
php-general-digest-help
lists.php.net
Date: Sat Nov 29 2003 - 00:13:58 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 29 Nov 2003 06:13:58 -0000 Issue 2443
Topics (messages 171294 through 171339):
Re: require_once() or die(); = fatal error
171294 by: Daevid Vincent
171318 by: Curt Zirzow
Re: php as cgi script
171295 by: Nicole Lallande
171301 by: Ivone Uribe
171302 by: Kelly Hallman
Call to undefined function: imagecreatefromjpeg()
171296 by: Philip J. Newman
171297 by: Marek Kilimajer
171299 by: Philip J. Newman
Re: Important notice
171298 by: John Nichel
171308 by: Bogdan Stancescu
Re: Forms and Arrays
171300 by: David T-G
Re: "Bless"ing an object
171303 by: Greg Beaver
IE6 Session Problem
171304 by: CF High
help with Log() function
171305 by: Jon King
Static Array vs MySQL query
171306 by: John Nichel
171307 by: Eric
171335 by: - Edwin -
how can i get rid of newlines?
171309 by: David T-G
171310 by: Leif K-Brooks
171311 by: Marek Kilimajer
171312 by: David T-G
171315 by: Marek Kilimajer
171316 by: David T-G
171317 by: Marek Kilimajer
171319 by: David T-G
171322 by: David T-G
Re: how can i get rid of newlines? [SOLVED]
171313 by: David T-G
171314 by: David T-G
New line problem - but for Excel
171320 by: Manisha Sathe
171321 by: David T-G
171325 by: Manisha Sathe
171326 by: David T-G
DAMN
171323 by: Bronislav Klucka
171324 by: Robert Cummings
171327 by: David T-G
171328 by: John Nichel
171329 by: Bronislav Klucka
171330 by: Bronislav Klucka
171331 by: Bronislav Klucka
171332 by: - Edwin -
171333 by: - Edwin -
171334 by: Bronislav Klucka
171339 by: - Edwin -
how to escape '\'
171336 by: Manisha Sathe
171337 by: Leif K-Brooks
171338 by: Bronislav Klucka
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Hmm... Well Rasmus, I do see your point, however it still seems to me it
'should' at least compile and work as I expect it to.
My way, the logic is that the file *is* 'required' (whereas I view 'include'
files as optional), and I want to exit the program with a graceful message
instead of the fatal error (which doesn't really doesn't tell me what the
problem is -- "Failed opening required '1'" doesn't mean anything to me or
the user) that is shown. My intent was to put a
require_once() so that I
could do just that. Especially since I'm running my script on the command
line, and your stock fatal error message uses HTML tags.
Not a critical bug or a show stopper, but I do still feel it is a bug.
> -----Original Message-----
> From: Rasmus Lerdorf [mailto:rasmus
php.net]
> Sent: Wednesday, November 26, 2003 8:55 PM
> To: Daevid Vincent
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] BUG: require_once() or die(); = fatal error
>
> This code doesn't make much sense. By definition, if require
> cannot open
> a file it throws a fatal error, so you would never hit the "or" case
> anyway. Hence there is no return code from require and you
> can't write
> code like this. If you want to test the return code you need to use
> 'include' instead.
>
> -Rasmus
>
> On Wed, 26 Nov 2003, Daevid Vincent wrote:
>
> > Using PHP 4.2.2 on Linux RH8:
> >
> > In a PHP script run from command line,
> >
> > require_once("gibberator_data.php") or die("No Data
> file found\n");
> >
> > Causes:
> >
> > [root
locutus gibberator]# ./gibberator.php
> > <br />
> > <b>Fatal error</b>: Failed opening required '1'
> > (include_path='.:/php/includes;/usr/share/phpwebtools') in
> > <b>/home/gibberator/gibberator.php</b> on line <b>13</b><br />
> >
> > However
> >
> > require_once("gibberator_data.php");
> >
> > Works just fine.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
attached mail follows:
* Thus wrote Daevid Vincent (daevid
daevid.com):
> My way, the logic is that the file *is* 'required' (whereas I view 'include'
> files as optional), and I want to exit the program with a graceful message
> instead of the fatal error (which doesn't really doesn't tell me what the
> problem is -- "Failed opening required '1'" doesn't mean anything to me or
> the user) that is shown. My intent was to put a
require_once() so that I
> could do just that. Especially since I'm running my script on the command
> line, and your stock fatal error message uses HTML tags.
Remove your 'or die()' and the message "required opening required
'1'" will show up properly.
About the html errors:
1. Use the php parameter -dhtml_errors=off
2. create a php-cli.ini in the location were php reads current php.ini
3. Use the -c parameter to tell php to use a different ini file
to read.
>
> Not a critical bug or a show stopper, but I do still feel it is a bug.
If your car does'nt float in the water is it the manufacturer's
fault?
Curt
--
"My PHP key is worn out"
PHP List stats since 1997:
http://zirzow.dyndns.org/html/mlists/
attached mail follows:
Ivone --
You are using a PERL invocation for php. PHP scripts begin with
<?php
the # sign is a comment in PERL - not in PHP.
To run php as cgi you need to install the php cgi version (as opposed to
the apache modular installation.) That will allow you to run cgi
scripts on the command line.
http://www.php.net/manual/en/install.commandline.php
Best regards,
Nicole
Ivone Uribe wrote:
>Hello all!
>
>I have this problem:
>
>I need to run a php
>(http://xx.yy.zz/cgi-bin/pruebacgi.php) that contains
>that line
>
>#!/usr/local/bin/php -q
>I get it an error from my apache log:
>malformed header from script. Bad header= php
>[options] -r <cod
>e>: /www/cgi-bin/pruebacgi.php
>I hope someone can help me! I don't know what can I
>do.
>
>In fact if I run any php that have this line
>#!/usr/local/bin/php
>I get an error like that
>Premature end of script headers:
>/www/cgi-bin/pruebacgi.php
>
>
>
>I have installed the php4.3.3 and apache 1.3.28.
>
>I configured the php with this line
>./configure --with-mysql
>--with-apache=../apache_1.3.28 --enable-track-vars
>
>Do I need to configure some else in my apache or php
>configuration file. Whan can I do to solve this
>problem?
>
>
>Thanks in advance!!!!!!!!
>KISSES
>Ivone
>
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Free Pop-Up Blocker - Get it now
>http://companion.yahoo.com/
>
>
>
attached mail follows:
Hi Nicole!
Thanks for your reply!
I'm a little confused:
Do I need to compile the php as cgi? I thought it was
when you wanted to run php from commanline: as
./pruebacgi.php
(Servers-CGI/Commandline)
But in my case I want to call a php like that:
http://xx.yy.zz/cgi-bin/pruebacgi.php
and this php has this line #!/usr/local/bin/php
Do I have to compile a php as a cgi, or do I need to
do something on the apache server? Please could you
clarify my doubts.
For example this is a sample of the code:
<?php
header("Content-Type: text/vnd.wap.wml");
$log=2;
$fp1 = fopen("logs/$HTTP_X_UP_SUBNO.get_location",
"a");
$separador="-x-x-x-x-x-x-x-x- ".date("l dS of F Y
h:i:s A")." -x-x-x-x-x-x-x-x-";
$qerror="0";
?>
<?echo "<?xml version=\"1.0\"
encoding=\"ISO-8859-1\"?>\r\n";?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd">
<wml>
<card title="teste">
<p align="center">
<br/>Test<br/>
</p>
</card>
</wml>
I really appreciate your help.
Kisses,
Ivone
--- Nicole Lallande <nicole
nmlconsulting.com> wrote:
> Ivone --
>
> You are using a PERL invocation for php. PHP
> scripts begin with
> <?php
>
> the # sign is a comment in PERL - not in PHP.
>
> To run php as cgi you need to install the php cgi
> version (as opposed to
> the apache modular installation.) That will allow
> you to run cgi
> scripts on the command line.
>
> http://www.php.net/manual/en/install.commandline.php
>
> Best regards,
>
> Nicole
>
> Ivone Uribe wrote:
>
> >Hello all!
> >
> >I have this problem:
> >
> >I need to run a php
> >(http://xx.yy.zz/cgi-bin/pruebacgi.php) that
> contains
> >that line
> >
> >#!/usr/local/bin/php -q
> >I get it an error from my apache log:
> >malformed header from script. Bad header= php
> >[options] -r <cod
> >e>: /www/cgi-bin/pruebacgi.php
> >I hope someone can help me! I don't know what can I
> >do.
> >
> >In fact if I run any php that have this line
> >#!/usr/local/bin/php
> >I get an error like that
> >Premature end of script headers:
> >/www/cgi-bin/pruebacgi.php
> >
> >
> >
> >I have installed the php4.3.3 and apache 1.3.28.
> >
> >I configured the php with this line
> >./configure --with-mysql
> >--with-apache=../apache_1.3.28 --enable-track-vars
> >
> >Do I need to configure some else in my apache or
> php
> >configuration file. Whan can I do to solve this
> >problem?
> >
> >
> >Thanks in advance!!!!!!!!
> >KISSES
> >Ivone
> >
> >
> >
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Free Pop-Up Blocker - Get it now
> >http://companion.yahoo.com/
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
attached mail follows:
On Fri, 28 Nov 2003, Nicole Lallande wrote:
> Ivone --
> You are using a PERL invocation for php. PHP scripts begin <?php
#! is not a perl invocation, it is a Unix convention to tell the shell
which program should be used to process the file contents. If you are
running PHP as a CGI from a webserver, chances are good you do want
#!/path/to/php as the first line, and <?php on the next line.
I don't think you can pass a flag like #!/usr/bin/php -q though, and I
doubt you would want to, since you still need to send the headers upon
first output. If you did not send headers and just started outputting, the
server would return a 500 Internal Server Error.
The directory you're running it from needs to have ExecCGI permission
(i.e. /cgi-bin/) and assuming no special setup has been done, you probably
want to start the file off with that #! line as mentioned above. Also, you
may want to try naming the file .cgi
> the # sign is a comment in PERL - not in PHP.
# also denotes a comment in PHP. Though #! is not a comment, per se.
(However, if you feed the file directly to some interpreter like perl, it
does have the benefit of being ignored as a comment.)
> To run php as cgi you need to install the php cgi version (as opposed to
> the apache modular installation.) That will allow you to run cgi
> scripts on the command line.
CGI stands for common gateway interface, which is the interface between a
web server/request and some external program, so it has little to do with
the command line. However, to run PHP from the command line, you do need
to run it with the "CGI version" of PHP. The question did not specify
needing to run PHP from the command line, but as a CGI by the webserver.
--
Kelly Hallman
// Ultrafancy
attached mail follows:
http://www.php.net/manual/en/function.imagecreatefromjpeg.php
After using this code for some time it suddenly returns ...
Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/crushme/public_html/includes/inc_members.php on line 564
<?Php
// SNIP
$quality="70"; // JPEG Image Quality (0-95 Higher Value == Better)
// Resize Create the Output Image (Do Not Disturb this part)
$src_img = imagecreatefromjpeg("$src_img");
$dst_img = imagecreatetruecolor($dest_width,$dest_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imageinterlace($dst_img, 1);
imagejpeg($dst_img, "$dest_file", $quality);
imagedestroy($src_img);
imagedestroy($dst_img);
// SNIP
?>
Is this the server or code that needs to be changed.
attached mail follows:
Philip J. Newman wrote:
> http://www.php.net/manual/en/function.imagecreatefromjpeg.php
>
> After using this code for some time it suddenly returns ...
It's not suddenly, someone must have recompiled php without gd/jpg support.
>
> Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/crushme/public_html/includes/inc_members.php on line 564
>
>
> <?Php
>
> // SNIP
>
> $quality="70"; // JPEG Image Quality (0-95 Higher Value == Better)
> // Resize Create the Output Image (Do Not Disturb this part)
> $src_img = imagecreatefromjpeg("$src_img");
> $dst_img = imagecreatetruecolor($dest_width,$dest_height);
> imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
> imageinterlace($dst_img, 1);
> imagejpeg($dst_img, "$dest_file", $quality);
> imagedestroy($src_img);
> imagedestroy($dst_img);
>
> // SNIP
>
> ?>
>
> Is this the server or code that needs to be changed.
>
>
attached mail follows:
... just what i was thinking, i'll get back to them and complain.
Thanks
----- Original Message -----
From: "Marek Kilimajer" <kilimajer
webglobe.sk>
To: <NewmanPj
PhilipNZ.com>
Cc: <php-general
lists.php.net>
Sent: Saturday, November 29, 2003 8:29 AM
Subject: Re: [PHP] Call to undefined function: imagecreatefromjpeg()
> Philip J. Newman wrote:
> > http://www.php.net/manual/en/function.imagecreatefromjpeg.php
> >
> > After using this code for some time it suddenly returns ...
>
> It's not suddenly, someone must have recompiled php without gd/jpg support.
>
> >
> > Fatal error: Call to undefined function: imagecreatefromjpeg() in
/home/crushme/public_html/includes/inc_members.php on line 564
> >
> >
> > <?Php
> >
> > // SNIP
> >
> > $quality="70"; // JPEG Image Quality (0-95 Higher Value == Better)
> > // Resize Create the Output Image (Do Not Disturb this part)
> > $src_img = imagecreatefromjpeg("$src_img");
> > $dst_img = imagecreatetruecolor($dest_width,$dest_height);
> > imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width,
$src_height);
> > imageinterlace($dst_img, 1);
> > imagejpeg($dst_img, "$dest_file", $quality);
> > imagedestroy($src_img);
> > imagedestroy($dst_img);
> >
> > // SNIP
> >
> > ?>
> >
> > Is this the server or code that needs to be changed.
> >
> >
>
attached mail follows:
Chris W. Parker wrote:
> sales
dotregistrar.com <mailto:sales
dotregistrar.com>
> on Wednesday, November 26, 2003 9:30 PM said:
>
>>If you feel this transaction was made
>>by our mistake, please press "No".
>
> I keep clicking "No" but nothing is happening. PLEASE HELP! Maybe it's a
> bug with PHP??
>
> Chris.
My keyboard doesn't have a 'No' key.
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
attached mail follows:
John Nichel wrote:
> Chris W. Parker wrote:
>
>> sales
dotregistrar.com <mailto:sales
dotregistrar.com>
>> on Wednesday, November 26, 2003 9:30 PM said:
>>
>>> If you feel this transaction was made
>>> by our mistake, please press "No".
>>
>>
>> I keep clicking "No" but nothing is happening. PLEASE HELP! Maybe it's a
>> bug with PHP??
>>
>> Chris.
>
>
> My keyboard doesn't have a 'No' key.
>
Hey! You're both in violation of Internal Rule #44.15/78 by following up
on this thread! This is illegal! Or not. Or whatever. But anyway! I hope
you're up to date with The Reg's last updates on Fermat's legal issues.
Anonymous
attached mail follows:
Dave -
...and then Dave Carrera said...
%
% Thank you for clearing up my rather lame explanation.
%
% So how can I process $_POST[dynamic-name][user-entered-value] arrays to give
% me my desired output:
%
% fname0 = value flab0 = value fplc0 = value
Do you really want a variable called $fname0 and another $fname1 and so
on, or do you just want this output? It seems to me that you probably
want the latter, so you need only walk through your array:
foreach ( array_keys($_POST[fname]) as $k )
{
print "fname$k = {$_POST[fname][$k]} " ;
print "flab$k = {$_POST[flab][$k]} " ;
print "fplc$k = {$_POST[fplc][$k]}<br>\n" ;
}
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/x6OJGb7uCXufRwARAk/UAJ9k1b2ysqR/if6CbXIOPL2N7s8dWQCgvae6
MFpBW549MrtV5dlAUyaCodE=
=Vz4a
-----END PGP SIGNATURE-----
attached mail follows:
Hi Wouter,
The only disadvantage to assigning to $this is that it may not be
supported in PHP 5 - php-internals discussion has described it as a bad
idea. I would get beta 2 and test it out, see what happens.
Incidentally, you don't need to unset new, and I would use
$this =& $New;
Regards,
Greg
Wouter van Vliet wrote:
>Greg Beaver wrote:
>
>
>>Wouter,
>>
>>you could try this adding this method to each object you need
>>blessings from:
>>
>>function &bless($classname)
>>{
>> if ($classname == get_class($this)) {
>> return $this;
>> }
>> $vars = get_object_vars($this);
>> $ret = new $classname;
>> return $ret->loadValues($vars);
>>}
>>
>>function &loadValues($vals)
>>{
>> foreach ($vals as $name => $val) {
>> $this->$name = $val;
>> }
>> return $this;
>>}
>>
>>In the Load() method, you should determine what class you
>>need, and call $ret = &$this->bless('classname'), and then return
>>$ret.
>>
>>Then, instead of doing
>>
>>$Thing->Load();
>>
>>do
>>
>>$Thing = &$Thing->Load();
>>
>>and have Load() return an object instance (either $this or the newly
>>blessed object).
>>
>>This will maintain encapsulation and achieve the results you're
>>looking for.
>>
>>Regards,
>>Greg
>>
>>
>>
>
>Thanks Greg .. this comes pretty close to what I had done myself as a
>workaround. Only thing that's different is that in my bless implementation I
>don't return the blessed value, but overwrite the $this var. Which works.
>What advantage do you think I would get from your appraoch?
>
>[snip The Way I Bless {example from own memory, cannot reach the actual code
>at this time} ]
>function Bless($ClassName) {
> // return false if class doesn't exist
> if (!class_exists($ClassName)) return false;
>
> $New = new $ClassName();
>
> foreach($this as $Key => $Value) $New[$Key] = $Value;
> $this = $New;
> unset $New);
>}
>[/snip The Way I Bless]
>
>Hmm .. maybe I'm thinking 'out of te box' here, but can I manually add this
>functionality to stdClass, so that they are available in each and ever
>object I create?
>
>
>
>
>
>
>
>
attached mail follows:
Hey all.
Hope this will help someone hours of useless searching.
Looks like out-of-the-box winXP machines running IE6 have session cookies
automatically disabled!
Ughhhh, 24 hours slogging through newsgroups to stumble across this solution
myself.
If you have a login based site & rely on session(s), IE6 users will not be
able to log in unless they do the following:
1) Internet Options >> Privacy >> Advanced
2) Check the "Always Allow Session Cookies" checkbox
HTH,
--Noah
--
attached mail follows:
Hello,
I'm having trouble getting a log formula to work. This forumla is supposed
to return the number of payment required zero out a loan balance.
<!------- snip --------------->
/*
n = - (LN(1-(B/m)*(r/q)))/LN(1+(r/q))
q = amount of annual payment periods
r = interest rate
B = principal
m = payment amount
n = amount payment periods
LN = natural logarithm
*/
$q = 12;
$r = 0.07;
$B = 150000;
$m = 733;
print -(log(1-($B/$m)*($r/$q)))/log(1+($r/$q));
<--- end snip ---->
It keeps returning a NaN. I've checked the syntax over and over, but to no
avail.
Any help would be appreciated
TIA
Jon
attached mail follows:
Hi,
I'm designing my site to use drop down menus, and am having php
generate the content of the main manus, as well as the sub-menus. What
I'm wondering is what the performance hit will be with putting all the
menu variables into an array in a config file vs storing the info in a
MySQL table, and retriving the data from there. The main menu data is
currently in a config file, and takes up 1.4kb, so I can only assume
that with how many sub-menus that to config it all in a static array,
the filesize is going to be well over 20kb. The data would have to be
read into memory from both the static file, or from the db, so which do
you think would be the fastest and/or least memory intensive? Thanks
for any suggestions.
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
attached mail follows:
"John Nichel" <jnichel
by-tor.com> wrote in message
news:3FC7D5DE.3040103
by-tor.com...
> Hi,
>
> I'm designing my site to use drop down menus, and am having php
> generate the content of the main manus, as well as the sub-menus. What
> I'm wondering is what the performance hit will be with putting all the
> menu variables into an array in a config file vs storing the info in a
> MySQL table, and retriving the data from there. The main menu data is
> currently in a config file, and takes up 1.4kb, so I can only assume
> that with how many sub-menus that to config it all in a static array,
> the filesize is going to be well over 20kb. The data would have to be
> read into memory from both the static file, or from the db, so which do
> you think would be the fastest and/or least memory intensive? Thanks
> for any suggestions.
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
Hi John
A common solution I once found for saving database operation time, was to
store information from the db in some kind of file.
You could for example have a database with all the data, but you run a
special script when there is any updates that updates a include file with
the data.
Under the generation process, you can simply make a script to get the data,
and dynamically make a php file that will be stored.
Eric
attached mail follows:
Hi,
On 2003/11/29, at 8:10, John Nichel wrote:
> Hi,
>
> I'm designing my site to use drop down menus, and am having php
> generate the content of the main manus, as well as the sub-menus.
> What I'm wondering is what the performance hit will be with putting
> all the menu variables into an array in a config file vs storing the
> info in a MySQL table, and retriving the data from there.
...[snipped]...
Instead of "generating" the menu(s) each time, why not create a static
[HTML] file which you can "call" by using file_get_contents() or
something and just "insert" it where it's needed?
Just an idea...
--
- E -
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/
attached mail follows:
Hi, all --
As has been discussed before, the nl2br function doesn't actually convert
newlines to breaks but instead is more like "nl2nlbr". That is,
input
like
this
becomes
input
<br>like
<br>this
instead of
input<br>like<br>this
as the name would indicate.
I need a true nl2br function to get rid of newlines; I am accepting a
changed ini file parameter but the newline kills me.
I tried
$v = preg_replace("/\n/","<br>",$v) ;
but, even though $v had embedded newlines and wasn't merely a single line
of that input, it didn't work. If this were perl I'd think that perhaps
I'd change my record delimiter but I don't know how to do that in php.
Any ideas?
TIA & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yANjGb7uCXufRwARAqlrAKC4TyokZrmyyDO8QWAXjXJLi6KSgwCg52CO
w4tReJAAdjFPxTVgluppfTg=
=C65S
-----END PGP SIGNATURE-----
attached mail follows:
David T-G wrote:
>I need a true nl2br function to get rid of newlines; I am accepting a
>changed ini file parameter but the newline kills me.
>
Try:
$text = preg_replace("/\r\n|\n|\r", '<br>', $text);
attached mail follows:
$string = str_replace("\n", '<br>', $string);
David T-G wrote:
> Hi, all --
>
> As has been discussed before, the nl2br function doesn't actually convert
> newlines to breaks but instead is more like "nl2nlbr". That is,
>
> input
> like
> this
>
> becomes
>
> input
> <br>like
> <br>this
>
> instead of
>
> input<br>like<br>this
>
attached mail follows:
Marek, et al --
...and then Marek Kilimajer said...
%
% $string = str_replace("\n", '<br>', $string);
That didn't work for me. Interestingly enough, in light of Leif's post,
neither did \r\n in the search pattern. Hmmph. Well, thank heavens once
again for preg_replace() :-)
Thanks & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yAwZGb7uCXufRwARAsZEAKCM7d8VEM77mPYZGu67Gq4Bk7T6CACgmG4t
CLTA/t4oDoZpB1pPbwrIunc=
=MoPt
-----END PGP SIGNATURE-----
attached mail follows:
David T-G wrote:
> Marek, et al --
>
> ...and then Marek Kilimajer said...
> %
> % $string = str_replace("\n", '<br>', $string);
>
> That didn't work for me. Interestingly enough, in light of Leif's post,
> neither did \r\n in the search pattern. Hmmph. Well, thank heavens once
> again for preg_replace() :-)
>
>
> Thanks & HAND
>
> :-D
Right, I did not think about dos (\r\n) newlines. But Leif's code does
not consider mac newlines (\r) :-). This takes care of all:
$string = str_replace(array("\r\n","\n","\r"), '<br>', $string);
attached mail follows:
Marek --
...and then Marek Kilimajer said...
%
% David T-G wrote:
% >
% >...and then Marek Kilimajer said...
% >%
% >% $string = str_replace("\n", '<br>', $string);
% >
% >That didn't work for me. Interestingly enough, in light of Leif's post,
% >neither did \r\n in the search pattern. Hmmph. Well, thank heavens once
% >again for preg_replace() :-)
...
%
% Right, I did not think about dos (\r\n) newlines. But Leif's code does
Neither did I; after all, nothing in my loop is running DOS!
% not consider mac newlines (\r) :-). This takes care of all:
Are you sure about that? He had
"/\r\n|\n|\r"
which, once I close the search delimiter, certainly should capture a mac
end-of-line...
%
% $string = str_replace(array("\r\n","\n","\r"), '<br>', $string);
Hmmm... I didn't try it as an array, but str_replace() failed for me
with both "\n" and "\r\n"...
Thanks & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yBTzGb7uCXufRwARAtEWAJ4qW+PzndDaD1jPQJf/h1ccnDKuFACgxdId
DPG/zwq0wYwAe5/8c6xcDMg=
=tJOG
-----END PGP SIGNATURE-----
attached mail follows:
David T-G wrote:
>
> Are you sure about that? He had
>
> "/\r\n|\n|\r"
>
> which, once I close the search delimiter, certainly should capture a mac
> end-of-line...
>
My bad, I should not aswer questions at 4:30 a.m.
attached mail follows:
Marek --
...and then Marek Kilimajer said...
%
% David T-G wrote:
% >
% >Are you sure about that? He had
% >
% > "/\r\n|\n|\r"
...
%
% My bad, I should not aswer questions at 4:30 a.m.
No problem, and I'm glad you and others do, because I'm just getting
started for the long night ahead! :-)
But str_replace works for you? Interesting...
Thanks again & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yBb4Gb7uCXufRwARAiI9AKDmQSkHQ992ibdSF0zfprczE/89KACgt4dn
A/uca+7v1SOUPZbSbdX7vsQ=
=RLrz
-----END PGP SIGNATURE-----
attached mail follows:
Marek, et al --
...and then David T-G said...
%
% But str_replace works for you? Interesting...
I mucked about with it again and got it to work as long as I used an
array for $search... I must have had a typo last time. Well, yay; I
can rest easy knowing that I am using the faster function.
Now, believe it or not, I'm trying to put the newlines BACK IN so that my
users don't ever know the difference :-) It works fine so far except
that I have a caching problem, I think, since upon load it's fine but the
load-after-change just shows <br> in the field. But I'm getting close :-)
Thanks again & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yCNxGb7uCXufRwARAsVHAKCDW1QDfF2vyhYrKAnmzBhNcjK5RwCfenOi
XsGd9yqIIZAyzVsqfQ9yj5Q=
=ZtCe
-----END PGP SIGNATURE-----
attached mail follows:
Leif, et al --
...and then Leif K-Brooks said...
%
% David T-G wrote:
%
% >I need a true nl2br function to get rid of newlines; I am accepting a
% >changed ini file parameter but the newline kills me.
% >
% Try:
% $text = preg_replace("/\r\n|\n|\r", '<br>', $text);
Aha! Sure enough, that did it. In fact, just
\r\n
worked for me, but as long as I'm looking for both I might as well look
for each. Who would think that input would be converted to DOS format?
This tickles the back of my mind as something that I've seen before, now
that it's shown to me again... I'm going to have to go looking now that
I know the answer to see if I can find it in the archives.
Thanks! & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yAybGb7uCXufRwARAgXRAJ42/ovCoJaApQ8QM/xcpgnAfaYu1QCglHOf
6eZ+8+l5T24C6hCPHmA47Rs=
=oFwz
-----END PGP SIGNATURE-----
attached mail follows:
Hi, all --
...and then David T-G said...
%
...
% This tickles the back of my mind as something that I've seen before, now
% that it's shown to me again... I'm going to have to go looking now that
% I know the answer to see if I can find it in the archives.
All I was able to find was some discussion of it back around July 13th,
wherein some \r\n talk went around, but Jason Giangrande, although he
said that his problem was solved, didn't say what the answer was!
Well, now I have. This will never come up again, right? ;-)
Thanks again & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yBFtGb7uCXufRwARAsuRAKDCqDKYGIaBmMbl3s7gZgbxifDpHACg12V0
Hji6ezFdUymxwiCM2degNIo=
=TL+i
-----END PGP SIGNATURE-----
attached mail follows:
Just now discussion was going on for new line - the same worked for me (I
used string replace)
Live Server : Linux / MySQL / PHP
There is a field called 'Address' (textarea) - mysql stores \n for carriage
return. Now from current disussion thread i know i can remove this with
something like <br> (may be something else also)
I want to export this to csv file. PHPMyAdmin 2.0 version has one option to
convert to csv with delimiter e.g ';' .
On my computer (Windows)
If I do not use string replace command then '\n' goes as a new row. If i
replace it with <br> then it appears in the Excel that is also I do not
want.
Is there any better way so that '\n' does not come out as new row - but do
not want to make use of <br> as this will appear, please suggest,
regards
manisha
When i open it in Excel now that \n becoms a new row which i do not want
attached mail follows:
Manisha --
...and then Manisha Sathe said...
%
% Just now discussion was going on for new line - the same worked for me (I
% used string replace)
It worked for me, too, once I got the grammar right. Must have been a
typo the first time I tried an array.
%
% Live Server : Linux / MySQL / PHP
%
% There is a field called 'Address' (textarea) - mysql stores \n for carriage
...
% convert to csv with delimiter e.g ';' .
...
% If I do not use string replace command then '\n' goes as a new row. If i
% replace it with <br> then it appears in the Excel that is also I do not
% want.
Good question.
The first thing I would try is embedding a return in a spreadsheet file
and then exporting that as CSV and see how Excel writes it, and then as a
close second read it back in and see if Excel can read it. Once you know
the format you can work to output the same thing from your php script.
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yCLoGb7uCXufRwARApj7AKDVLdp8rkqcB5O7S4HAUnjHNoP37wCfW+nf
ix0hNoSqSty9EUpu+jWg0P4=
=X++r
-----END PGP SIGNATURE-----
attached mail follows:
Actually I do not have phpscript for this. I am using readymade function
from PHPMyAdmin 2.1.0. They are having option to export to csv file with
delimeter ';' (It comes on screen first and then i copy to file manually.)
So my csv fil looks like
22;33;address line1
address line2
What excel does is it shows this as 2 different lines. But this all should
be in one line.
if replace \n with <br> then
22;33;address line1<br>address line2
Do u mean to say i need to write script only to produce proper '.csv' file ?
Regards,
Manisha
"David T-G" <davidtg-php
justpickone.org> wrote in message
news:20031129043904.GU9710
justpickone.org...
attached mail follows:
Manisha --
...and then Manisha Sathe said...
%
% Actually I do not have phpscript for this. I am using readymade function
% from PHPMyAdmin 2.1.0. They are having option to export to csv file with
% delimeter ';' (It comes on screen first and then i copy to file manually.)
Ah.
%
% So my csv fil looks like
%
% 22;33;address line1
% address line2
%
% What excel does is it shows this as 2 different lines. But this all should
% be in one line.
OK. So what does Excel do if you start with data like that and then
export to CSV? Can you have multi-line "records" in Excel? If so, are
they written as such?
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yCi1Gb7uCXufRwARAuYEAKDfNlhxXkxDZWcJzAfQllnYrKeHrwCfa2I9
oz/9SHxcyFNN+yJOAhKgD2w=
=hQtN
-----END PGP SIGNATURE-----
attached mail follows:
I've just realized I'm replaying to JeRRy only!!!! Could anybody fixt this
problem by setting the Reply To header correctly? to be able to reply PHP
conf. directly using Reply button?!!!
Brona
attached mail follows:
On Fri, 2003-11-28 at 23:55, Bronislav Klucka wrote:
> I've just realized I'm replaying to JeRRy only!!!! Could anybody fixt this
> problem by setting the Reply To header correctly? to be able to reply PHP
> conf. directly using Reply button?!!!
Look before you leap!
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
Brona --
You have started a new thread by taking an existing posting and replying to
it while you changed the subject.
That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a "References:" header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view ("tree view") of the postings.
With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.
Always do a fresh post when you want to start a new thread. To achieve this,
click on "New message" instead of "Reply" within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.
...and then Bronislav Klucka said...
%
% I've just realized I'm replaying to JeRRy only!!!! Could anybody fixt this
Even worse, you have hijacked a completely separate thread rather than
even the one remotely related to your post. That's like hijacking your
own hijacking!
% problem by setting the Reply To header correctly? to be able to reply PHP
% conf. directly using Reply button?!!!
Please, not this discussion again; the last one isn't even cool!
If you somehow missed it, and if you can't check the archives, I will
personally bounce you all 105 messages in the monster thread from earlier
this week rather than have it start up again. If you're not careful, I
suspect that a number of other list members will do the same thing to
you.
%
% Brona
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg
justpickone.org * society and not sufficient moral courage.
(work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
iD8DBQE/yCnpGb7uCXufRwARAlfQAKCxOxfYVeui8U8oC8B2kRnXEvdMEwCg45zr
IDIZOrzmZRCoGe+igYZEmbM=
=sdCK
-----END PGP SIGNATURE-----
attached mail follows:
Bronislav Klucka wrote:
> I've just realized I'm replaying to JeRRy only!!!! Could anybody fixt this
> problem by setting the Reply To header correctly? to be able to reply PHP
> conf. directly using Reply button?!!!
>
> Brona
>
How many times is someone going to start this flame war this month?
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
attached mail follows:
Till admin fix it????
Brona
> -----Original Message-----
> From: John Nichel [mailto:jnichel
by-tor.com]
> Sent: Saturday, November 29, 2003 6:18 AM
> To: PHP Konference
> Subject: Re: [PHP] DAMN
>
>
> Bronislav Klucka wrote:
>
> > I've just realized I'm replaying to JeRRy only!!!! Could
> anybody fixt this
> > problem by setting the Reply To header correctly? to be able to
> reply PHP
> > conf. directly using Reply button?!!!
> >
> > Brona
> >
>
> How many times is someone going to start this flame war this month?
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Sorry, I realized it was wrong :(((((
> -----Original Message-----
> From: David T-G [mailto:davidtg-php
justpickone.org]
> Sent: Saturday, November 29, 2003 6:09 AM
> To: PHP General list
> Cc: Bronislav Klucka
> Subject: Re: [PHP] DAMN
>
>
> Brona --
>
> You have started a new thread by taking an existing posting and
> replying to
> it while you changed the subject.
>
> That is bad, because it breaks threading. Whenever you reply to a message,
> your mail client generates a "References:" header that tells all
> recipients
> which posting(s) your posting refers to. A mail client uses this
> information
> to build a threaded view ("tree view") of the postings.
>
> With your posting style you successfully torpedoed this useful
> feature; your
> posting shows up within an existing thread it has nothing to do with.
>
> Always do a fresh post when you want to start a new thread. To
> achieve this,
> click on "New message" instead of "Reply" within your mail
> client, and enter
> the list address as the recipient. You can save the list address in your
> address book for convenience.
>
> ...and then Bronislav Klucka said...
> %
> % I've just realized I'm replaying to JeRRy only!!!! Could
> anybody fixt this
>
> Even worse, you have hijacked a completely separate thread rather than
> even the one remotely related to your post. That's like hijacking your
> own hijacking!
>
>
> % problem by setting the Reply To header correctly? to be able to
> reply PHP
> % conf. directly using Reply button?!!!
>
> Please, not this discussion again; the last one isn't even cool!
>
> If you somehow missed it, and if you can't check the archives, I will
> personally bounce you all 105 messages in the monster thread from earlier
> this week rather than have it start up again. If you're not careful, I
> suspect that a number of other list members will do the same thing to
> you.
>
>
> %
> % Brona
>
>
> HTH & HAND
>
> :-D
> --
> David T-G * There is too much animal courage in
> (play) davidtg
justpickone.org * society and not sufficient moral courage.
> (work) davidtgwork
justpickone.org -- Mary Baker Eddy, "Science
> and Health"
> http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
>
>
attached mail follows:
I'll shut up, I didn't realized there were some flame war, but somebody
should do:
1/ Fix this "Reply to" problem
(mail comes from PHP conference I suppose I should reply to this conference)
2/ Fix the problem with non existing users (or mailboxes, where cannot be
mail deliver to)
I'll really shut up. but these problems are quite annoying...
Brona
P.S. Now I almost answered myself...
attached mail follows:
I think...
On 2003/11/29, at 14:30, Bronislav Klucka wrote:
> I'll shut up, I didn't realized there were some flame war, but somebody
> should do:
> 1/ Fix this "Reply to" problem
> (mail comes from PHP conference I suppose I should reply to this
> conference)
You just missed the point:
http://marc.theaimsgroup.com/?t=106977953400001&r=1&w=2
> 2/ Fix the problem with non existing users (or mailboxes, where cannot
> be
> mail deliver to)
>
> I'll really shut up. but these problems are quite annoying...
What "problemS"?
--
- E -
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/
attached mail follows:
On 2003/11/29, at 14:17, John Nichel wrote:
> Bronislav Klucka wrote:
>
>> I've just realized I'm replaying to JeRRy only!!!! Could anybody fixt
>> this
>> problem by setting the Reply To header correctly? to be able to reply
>> PHP
>> conf. directly using Reply button?!!!
>> Brona
>
> How many times is someone going to start this flame war this month?
Hmm... A *better* question would be "How many people does NOT start
it?" ;)
--
- E -
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/
attached mail follows:
I would really like to stop this thread but...
1/ "What problemS"?? the two I mentioned?
2/ I do not hawe time ro read the whole war you send me link to, I read just
one mail
"Having read this thread, must say I wonder where is this
world is going when people who consider themselves
coders are "confused about this email thingie"."
and I have to say that I have to wonder, that somebody could release it as
mail conference... I consider myself as programmer and I would never do
anything like this... Do not be wonder about our confusion, we are PHP
programers and that is why we are confused : because we know that this bug
has easy solution...
Brona
> -----Original Message-----
> From: - Edwin - [mailto:copperwa11s
yahoo.co.jp]
> Sent: Saturday, November 29, 2003 6:39 AM
> To: Bronislav Klucka
> Cc: PHP Konference
> Subject: Re: [PHP] DAMN
>
>
> I think...
>
> On 2003/11/29, at 14:30, Bronislav Klucka wrote:
>
> > I'll shut up, I didn't realized there were some flame war, but somebody
> > should do:
> > 1/ Fix this "Reply to" problem
> > (mail comes from PHP conference I suppose I should reply to this
> > conference)
>
> You just missed the point:
>
> http://marc.theaimsgroup.com/?t=106977953400001&r=1&w=2
>
> > 2/ Fix the problem with non existing users (or mailboxes, where cannot
> > be
> > mail deliver to)
> >
> > I'll really shut up. but these problems are quite annoying...
>
> What "problemS"?
>
> --
>
> - E -
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! BB is Broadband by Yahoo!
> http://bb.yahoo.co.jp/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On 2003/11/29, at 14:54, Bronislav Klucka wrote:
> I would really like to stop this thread but...
>
> 1/ "What problemS"?? the two I mentioned?
The first one was/is NOT a problem.
> 2/ I do not hawe time ro read the whole war you send me link to, I
> read just
> one mail
[...]
Why don't you read one more:
http://marc.theaimsgroup.com/?l=php-general&m=106988902220400&w=2
--
- E -
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/
attached mail follows:
I have magic_quotes_gpc ON
'Here's is' - this comes out after HTTP post as
'Here\'s is'
But i want to get back the original string as it is - how to change ?
manisha
attached mail follows:
Manisha Sathe wrote:
>I have magic_quotes_gpc ON
>
>'Here's is' - this comes out after HTTP post as
>
>'Here\'s is'
>
>But i want to get back the original string as it is - how to change ?
>
www.php.net/stripslashes
attached mail follows:
try "stripslashes()"
Brona
> -----Original Message-----
> From: Manisha Sathe [mailto:manisha
starhub.net.sg]
> Sent: Saturday, November 29, 2003 7:03 AM
> To: php-general
lists.php.net
> Subject: [PHP] how to escape '\'
>
>
> I have magic_quotes_gpc ON
>
> 'Here's is' - this comes out after HTTP post as
>
> 'Here\'s is'
>
> But i want to get back the original string as it is - how to change ?
>
> manisha
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]