I have a string I'm returning from a database. Some entries have # signs
in the names ie (COMPANY #42, COMPANY #43...). When I display results
all I have is COMPANY. Everything after the # is dropped off. I tried:
If ($cust) {
$cust2=ereg_replace('#','no',$cust);
//tried
Why don't you just try:
$cust2 = str_replace('#','#35;',$cust);
That should replace all instances of # with it's html entity equivalent. If
that doesn¹t work then there is something else wrong with your script and
we'll need to see it all! :)
Rick
People who drink to drown their sorrow should
Have to be a bit more specific, cause I can't reproduce your
problem... Do you have some code examples that show it clearer?
name for client is COMPANY #1 in DB
?php
include dbconnect.inc; //sets up db connection
$sel = mysql_query(select name from client
where
Hello,
Ernest E Vogelsinger [EMAIL PROTECTED] wrote:
At 23:53 14.11.2002, Lars Espelid said:
[snip]
Try to execute this code:
if (ereg[^0-9], $num))
print That's not a number!;
result: parsing error, expects ')' on the if-line.
You forgot an
Hello,
I'm running Apache 1.3.26, PHP 4.0.5 and WinXPpro.
My problem is as follows:
Try to execute this code:
if (ereg[^0-9], $num))
print That's not a number!;
result: parsing error, expects ')' on the if-line.
Have also tried other expressions where I escape characters. They won't
work.
Hello again...
Lars Espelid wrote:
Hello,
I'm running Apache 1.3.26, PHP 4.0.5 and WinXPpro.
My problem is as follows:
Try to execute this code:
if (ereg[^0-9], $num))
print That's not a number!;
result: parsing error, expects ')' on the if-line.
This one does have a parse error
At 23:53 14.11.2002, Lars Espelid said:
[snip]
Try to execute this code:
if (ereg[^0-9], $num))
print That's not a number!;
result: parsing error, expects ')' on the if-line.
You forgot an opening bracket, and need to quote the regex, like
if
Im trying to move some binary strings from mysql to postgresql,
and the binary strings has escape chars '\' in them.
I was told to double escape them like so - '\\\'
Here is what Im trying -
$data = '\0PZ\0Îê˜Úµ'; // This is a representation from an mysql dump
$data2 = str_replace('/\',
Just escape the \ with a single escape character. eg. your string
'\0PZ\0Îê˜Úµ' would end up as '\\0PZ\\0Îê˜Úµ' - each \ simply
escapes the backslash following it. If you add two backslashes, you end
up with one too many which is what the error is referring to.
..micahel..
On Thu,
One of the guys over on the php-db list told me that to store the binary
string correctly in postrgresql, that I would
have to double quote whats already there.
So in essence, by the time it hits the database, it has to be -
\\\0PZ\\\0Îê˜Úµ
Any suggestions to modify the string like this...
I'm stumbling over how to allow people to put single or double quotes
in a form text field.
I am passing the form to itself ($PHP_SELF) and on the second time
through previewing what the form data will look like and also
re-creating the form with the data already filled in.
Here's an example
See: http://www.php.net/manual/en/function.htmlspecialchars.php
John Hughes wrote:
I'm stumbling over how to allow people to put single or double quotes
in a form text field.
I am passing the form to itself ($PHP_SELF) and on the second time
through previewing what the form data will
is ignored.
Same for the double quotes.
---John Holmes...
- Original Message -
From: Robert Cummings [EMAIL PROTECTED]
To: John Hughes [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, May 06, 2002 5:06 PM
Subject: Re: [PHP] escaping quotes in forms and redisplaying variables in
form
Hi -- I'm trying to use a string of XML data which includes the use of
the ?xml ? tags. I've noticed that my editor (BBEdit) shows that \?
will escape the tag so that PHP does not treat it as a true close the
PHP code tag, but was hoping that someone here could give me an
official ruling.
Well, this is a fairly simple problem. I'm having problems with escaping a
string, and then ending the string right after the escape! For example,
echo Then Johnathan said, \That's exactly what I said!\;
I get a parse error on the line where the string is. Very simple problem, I
just can't seem
On Tue, 19 Mar 2002, Dr. Shim wrote:
Well, this is a fairly simple problem. I'm having problems with escaping a
string, and then ending the string right after the escape! For example,
echo Then Johnathan said, \That's exactly what I said!\;
I get a parse error on the line where the string
Hmmm. How about this?
echo form name=\frmMovies\ method=\post\ action=\ . echo $PHP_SELF
. \;
Miguel Cruz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Tue, 19 Mar 2002, Dr. Shim wrote:
Well, this is a fairly simple problem. I'm having problems with
You need to remove the second echo.
On Tue, 19 Mar 2002, Dr. Shim wrote:
Hmmm. How about this?
echo form name=\frmMovies\ method=\post\ action=\ . echo $PHP_SELF
. \;
Miguel Cruz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Tue, 19 Mar 2002,
On Tue, 19 Mar 2002, Dr. Shim wrote:
Hmmm. How about this?
echo form name=\frmMovies\ method=\post\ action=\ . echo $PHP_SELF
. \;
You're concatenating echo $PHP_SELF rather than just $PHP_SELF, which
isn't necessarily helping. But just between me and you, life would be a
lot easier if
Strangley enough, $PHP_SELF is empty. Nothing appears when I do it the way
Bob and you suggested, the action property equals .
Miguel Cruz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Tue, 19 Mar 2002, Dr. Shim wrote:
Hmmm. How about this?
echo form
Are you inside a function, having neglected to do
global $PHP_SELF;
?
miguel
On Tue, 19 Mar 2002, Dr. Shim wrote:
Strangley enough, $PHP_SELF is empty. Nothing appears when I do it the way
Bob and you suggested, the action property equals .
Miguel Cruz [EMAIL PROTECTED] wrote in
*screams, I'm such a newbie!!*
I didn't know I had to declare $PHP_SELF with global before using it
inside a function. Sorry! Works now! Thanks very much! =)
Miguel Cruz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Are you inside a function, having neglected
PROTECTED]
Subject: RE: [PHP] escaping ?
what about this?
$contents = str_replace('?xml version=1.0?'.'', '', $contents);
-Original Message-
From: Steven Jarvis [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 09, 2002 8:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] escaping
what about this?
$contents = str_replace('?xml version=1.0?'.'', '', $contents);
-Original Message-
From: Steven Jarvis [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 09, 2002 8:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] escaping ?
I'm trying to do some string replaces on XML
I'm trying to do some string replaces on XML files to import them into a
prprietary db that doesn't understand XML.
I need to strip the XML tags out of the file.
However, when I use this line:
$contents = str_replace('?xml version=1.0?', '', $contents);
The ? in the string ends my php block.
Hi, try this:
str_replace(?xml version=\1.0\?
Jeff
At 03:45 PM 2/8/2002 -0600, Steven Jarvis wrote:
I'm trying to do some string replaces on XML files to import them into a
prprietary db that doesn't understand XML.
I need to strip the XML tags out of the file.
However, when I use this
Any idea why when I print the value of $text, I get a backslash in front of
the result?
$text=preg_replace(/\/, quot;, $text);
$text=preg_replace(/\/, A, $text);
$text=str_replace(\, A, $text);
Contrary:
$text=preg_replace(//, amp;, $text);
works quite well.
cheerz
--
PHP General
I'm tring to print the variable tmp, but the echo is just printing abcd,
the rest he can't print.
Why?
regards,
Augusto
$tmp=abcdefg;
echo $tmp.br;
echo br;
$tmp=addslashes($tmp);
echo $tmp.br;
echo br;
$tmp=stripslashes($tmp);
echo $tmp.br;
--
PHP General Mailing List
on 5/16/01 9:12 PM, Augusto Cesar Castoldi at [EMAIL PROTECTED] wrote:
I'm tring to print the variable tmp, but the echo is just printing abcd,
the rest he can't print.
Why?
regards,
Augusto
$tmp=abcdefg;
echo $tmp.br;
echo br;
$tmp=addslashes($tmp);
echo $tmp.br;
echo br;
""Wade"" [EMAIL PROTECTED] wrote in message
9c6dcb$h8e$[EMAIL PROTECTED]">news:9c6dcb$h8e$[EMAIL PROTECTED]...
Aside from " (quotes), which HTML characters should be preceded with a \
(backslash) to avoid parsing errors?
No.
I have the following, which I have in an .inc file outside my web
-Original Message-
From: Wade [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 8:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Escaping Characters
Aside from (quotes), which HTML characters should be preceded with a \
(backslash) to avoid parsing errors?
I have the following
My previous post is a bit misleading.
""Wade"" [EMAIL PROTECTED] wrote in message
9c6dcb$h8e$[EMAIL PROTECTED]">news:9c6dcb$h8e$[EMAIL PROTECTED]...
Aside from " (quotes), which HTML characters should be preceded with a \
(backslash) to avoid parsing errors?
No and Yes.
NO: You don't have to
H-
I've been able to escape the 'space' character in a variable so it can
be safely passed through a URL but I'm having trouble finding anything
that works for escaping the '' ampsand.
Here is a snippet of code.
$topic = Aerospace Commercial Space;
$link_value = str_replace(, '%26',
Sterling wrote:
$topic = Aerospace Commercial Space;
$link_value = str_replace(, '%26', $topic);
$link_value = str_replace(' ', '%20', $topic);
This should be
$link_value = str_replace(, '%26', $topic);
$link_value = str_replace(' ', '%20', $link_value);
Anyway, this is this wrong way to
I've been able to escape the 'space' character in a variable so it can
be safely passed through a URL but I'm having trouble finding anything
that works for escaping the '' ampsand.
php.net/urlencode
as for your code:
$topic = Aerospace Commercial Space;
$link_value = str_replace(,
Hey everyone,
Doesn anyone knowhow to escape the following
line in a perl print statement?
if(!isset($mainfile)) { include("mainfile.php");
}
ie:
sub
header{ print "?php echo
if(!isset($mainfile)) { include(\"mainfile.php\"); } ?\n";
}
What all needs to be escaped?
Thanks!
Clayton
How do you escape double quotes? I have the following which is
supposed to make any " in a string into \" but it doesn't seem to
work. What's wrong with it?
$tmp_string = str_replace ("\"", "\\\"", $tmp_string);
-Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
addslashes() usually works for me...
--Joe
On Sun, Feb 25, 2001 at 01:46:30AM -0500, Ben Cheng wrote:
How do you escape double quotes? I have the following which is
supposed to make any " in a string into \" but it doesn't seem to
work. What's wrong with it?
$tmp_string = str_replace
101 - 138 of 138 matches
Mail list logo