php-general Digest 29 Oct 2005 09:47:24 - Issue 3764
Topics (messages 224791 through 224800):
Re: calling static method within class
224791 by: Carlo Razzeto
224798 by: Tom Rogers
Re: foreach / unset
224792 by: Richard Lynch
UTF-8 to ISO-8859-1
224793 by:
I'm trying to figure out if PHP has the facility to reference containing,
non-parent objects. I have three classes, embedded hierarchically, but which
are NOT extended classes of their containing objects. I'd like to be able to
reference variables in the higher-level objects from the
Oliver Grätz wrote:
Shaun schrieb:
$qid = mysql_query('INSERT INTO MYTABLE (
column1,
column2,
) VALUES (
'.$value1.',
'.$value2.'
Hi there,
I am storing images outside the webroot to keep them from being accessible
for unauthorized users to see.
Then I use a script to show the images, like this:
img src=show.php
Now, as there is no information on the images stored in a database yet (they
have just been uploaded via ftp),
Richard Lynch wrote:
Anyway, can you do *this* safely as a DOCUMENTED FEATURE:
foreach($array as $k = $v){
if (...) unset($array[$k]);
}
Well, somewhere in the said manual it is written that foreach operates
on a *copy* of the array, so you should be safe unsetting values in the
Morgan Doocy wrote:
I'm trying to figure out if PHP has the facility to reference containing,
non-parent objects. I have three classes, embedded hierarchically, but which
are NOT extended classes of their containing objects. I'd like to be able to
reference variables in the higher-level
Hi,
I need to extract 50 words more or less from a description field. How can i
do that?. Substr, cuts the words. Is there any other way to that, without
using and array? I mean and implemented function in PHP 4.x
I´ve been googling around, but wordwrap, and substr is driving me mad...
Thanks
Finally i found it (Google is god, you only have to ask the right question)
function trim_text($text, $count){
$text = str_replace( , , $text);
$string = explode( , $text);
for ( $wordCounter = 0; $wordCounter = $count;wordCounter++ ){
$trimed .= $string[$wordCounter];
if ( $wordCounter $count
Strange behaviour that's taken me ages to track down. I have the
situation where I can create a session, but any changes to it are not
saved. session_write_close() didn't help. Eventually I tracked it
down: if you have register_long_arrays disabled (as is the default in
PHP5), this can
On 29 Oct 2005, at 14:48, Marcus Bointon wrote:
changing an item in $_SESSION simply does not get saved back to the
session file if register_long_arrays is enabled.
I meant disabled.
I've also tried using it with the mm session save handler and I get
the same symptoms. I also get
Good job!
However, let me give a few suggestions to optimize the code
function trim_text($text, $count)
{
$text = str_replace( , , $text);
/*
* This is redundant; you are replacing all in $text with
* maybe you meant
* $text = trim($text); ?
*/
Hi,
Does anyone know of a function for translating a decimal number into an
English number. In other words, if you pass it 1 it will return 'one', if
you pass it 127 it will return 'one hundred twenty seven', and etc.
Thanks,
Linda
--
PHP General Mailing List (http://www.php.net/)
To
Good start guys. That's usually how I start down the path in solving a new
problem. Invariably down the road I find a more refined way of doing what I
did the hard way. The hard way is good though, you learn stuff along the way.
Let's see how tight we can make this though:
?php
$string =
We're having a problem getting more than one imbedded PHP script to execute
in our Apache-served pages. We're using Apache 2.0.40 server-side includes.
We wish to include multiple PHP scripts into our pages but are only
succeeding in having the first included PHP script executed; the rest are
Hi Gurus,
I´ve got a problem with the result displaying a TEXT type field
The data is inserted into db in this way:
Hello,
This is a sample of first line.
This is another paragraph, blah
blah blah
Bye
But the result is in one paragraph:
Hello, This is a sample of first line.
This is
We're having a problem getting more than one imbedded PHP script to execute in
our Apache-served pages. We're using Apache 2.0.40 server-side includes. We
wish to include multiple PHP scripts into our pages but are only succeeding in
having the first included PHP script executed; the rest are
We wish to include multiple PHP scripts into our pages but are only
succeeding in having the first included PHP script executed; the rest are
ignored or misinterpreted as HTML...
I don't know if this is part of your problem, but when you do an include,
it throws you out of php. So, if there
The data is inserted into db in this way:
Hello,
This is a sample of first line.
This is another paragraph, blah
blah blah
Bye
But the result is in one paragraph:
Hello, This is a sample of first line.
This is another paragraph, blah
blah blah Bye
It sounds as if your database record
I couldn't find one out there Linda (and I'm sure I've seen them before) so
since I'm stuck at work on a Saturday I thought I'd take a break and see if I
could hack this out myself.
Probably a more elegant way to do this, but here's what I came up with. Feel
free to use and modify it at will.
On Sat, 2005-10-29 at 12:13 -0700, Linda H wrote:
Does anyone know of a function for translating a decimal number into an
English number. In other words, if you pass it 1 it will return 'one', if
you pass it 127 it will return 'one hundred twenty seven', and etc.
On Sat, October 29, 2005 6:36 am, Danny wrote:
I need to extract 50 words more or less from a description field. How
can i
do that?. Substr, cuts the words. Is there any other way to that,
without
using and array? I mean and implemented function in PHP 4.x
I´ve been googling around, but
Did you actually test that?
Even better version of your function,
code
$string = one two three four;
echo substr($string, -4);
echo '...';
/code
James
Danny wrote:
Finally i found it (Google is god, you only have to ask the right question)
function trim_text($text, $count){
$text
On Sat, October 29, 2005 10:51 am, Minuk Choi wrote:
function trim_text($text, $count)
{
$text = str_replace( , , $text);
/*
* This is redundant; you are replacing all in $text with
* maybe you meant
* $text = trim($text); ?
*/
It was
On Sat, October 29, 2005 4:45 am, Bogdan Ribic wrote:
$value1 = 'xyz,xyz); DELETE FROM MYTABLE;';
you might get surprising results!
This is called SQL injection and it's important to escape all the
values
before putting them into the statement.
Did you try that? This doesn't work on my
Hi,
why don't you use normal php include (require) functions? Why do you
want to mix apache server side includes with php code? There is nothing
php include can't do..
Just change all
!--#INCLUDE virtual=--
to
? include(''); ?
Petr
Don Brown wrote:
We're having a problem
http://php.net/nl2br
On Sat, October 29, 2005 12:07 pm, Danny wrote:
Hi Gurus,
I´ve got a problem with the result displaying a TEXT type field
The data is inserted into db in this way:
Hello,
This is a sample of first line.
This is another paragraph, blah
blah blah
Bye
But the
On Sat, October 29, 2005 12:01 pm, Don Brown wrote:
We're having a problem getting more than one imbedded PHP script to
execute in our Apache-served pages. We're using Apache 2.0.40
server-side includes. We wish to include multiple PHP scripts into our
pages but are only succeeding in having
On Fri, October 28, 2005 10:00 am, Shaun wrote:
I have some checkboxes on my page which correspond with boolean fields
in my
database - actually they are TINYINT's in which I store a 0 or 1 in
for
false and true values respectively.
Is it possible to loop through all $_POST values to see if
I usually place a hidden field with the same name as the checkbox
field before the actual checkbox field. I store my 'false' value in
there. If the checkbox is checked the hidden field is overridden.
?php
error_reporting( E_ALL );
if( isset( $_POST[ 'submit' ] ) )
{
echo 'pre';
On Fri, October 28, 2005 6:17 am, Tom Cruickshank wrote:
I've been reading up on printing out documents using PHP (using
Printer
functions calls in the php manual)
I'm using a Linux and/or FreeBSD operating system to run my php code
on (in
apache). However, I am surfing these pages
On Thu, October 27, 2005 9:56 pm, Chris wrote:
Though I suppose you could make an argument for using expressions that
consist of only constant values.
Actually...
One could argue that so long as the programmer was willing to accept
the consequences, there could be many legitimate circumstances
On Thu, October 27, 2005 11:05 am, Dan Trainor wrote:
It's been suggested to use readfile() to accomplish this, by
forwarding
content from outside of the document root - but this just sounds odd.
On top of being (what I think would be) incredibly slow, it just
doesn't
sound right.
A) It's
On Thu, October 27, 2005 5:04 am, Cabbar Duzayak wrote:
When someone sends an e-mail using php, exim sets the following 2
headers (along with others of course):
Received: from x.x.x.x (EHLO host.mydomain.com) (x.x.x.x) by
mta151.mail.dcn.yahoo.com with SMTP; Wed, 24 Sep 2005 10:29:04
On Thu, October 27, 2005 4:26 am, Danny wrote:
I´ve got a connection, to a MySQL db, and get the following
ResultSet(Category | Name | Code | City)
Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
Customers | Max | A36 | Paris
Providers | John | A36 | London
On Thu, October 27, 2005 3:43 am, Christoph Freundl wrote:
I have a problem with the persistence of environment variables when
mixing PHP and SSI (Apache) and I am not sure if I just made an error
or if this approach cannot work at all.
So please consider the following files:
I *believe* that
On Fri, October 28, 2005 9:36 am, Christoph Freundl wrote:
Perhaps I return to what I primarily intended to ask: is it really the
wanted behaviour of virtual() that changes that are made by the
included file do not influence the environment of the including file?
That is most definitely a
Hi,
I have a file, which I run using command line. The file I am running,
runs several files using passthru().
What I realise is, that it runs each file in sequence and waits for its
result.
I need to run all files at once and they don't have to return the result
to the main file. How do I do
On Sat, October 29, 2005 3:57 pm, Martin Zvarík wrote:
I have a file, which I run using command line. The file I am running,
runs several files using passthru().
What I realise is, that it runs each file in sequence and waits for
its
result.
I need to run all files at once and they don't
Hello.
What do you think about this:
?php
$MyOriginalString = This is my original string.\nWhat do you think
about this script?;
$MaxWords = 6; // How many words are needed?
echo substr( $MyOriginalString, 0, -strlen(ereg_replace
(^([[:space:]]*[^[:space:][:cntrl:]]+){1,$MaxWords},
If forgot to say that It counts ($MaxWords) words, It doesn't matter if
they're separated by simple spaces, line feeds (Unix, dos or mac), tabs,
among others.
On the other hand, you won't have any problem if you use non-English
characters.
Best regards,
Gustavo Narea.
Gustavo Narea wrote:
Gustavo Narea wrote:
If forgot to say that It counts ($MaxWords) words, It doesn't matter if
they're separated by simple spaces, line feeds (Unix, dos or mac), tabs,
And punctuation marks.
Sorry, I'm very forgetful tonight!
Cheers.
--
PHP General Mailing List (http://www.php.net/)
To
41 matches
Mail list logo