php-general Digest 3 Jun 2008 07:13:01 -0000 Issue 5494

Topics (messages 274924 through 274946):

strlower problem
        274924 by: Ed Curtis
        274925 by: Richard Heyes
        274927 by: Jim Lucas
        274928 by: Ed Curtis
        274929 by: Michael Kubler
        274930 by: Ed Curtis
        274931 by: Ted Wood

Re: Avoid object twice
        274926 by: Jim Lucas
        274944 by: Yui Hiroaki
        274946 by: James Dempster

imageColorAllocate problem
        274932 by: Jo Ann Comito

question about session variables
        274933 by: Sudhakar
        274935 by: Ted Wood

Links (A HREF) loosing my session
        274934 by: Razer Montaño
        274936 by: Ted Wood
        274937 by: Razer Montaño

Bug in SimpleXML?
        274938 by: Kyle Browning
        274940 by: Nathan Nobbe
        274941 by: Nathan Nobbe

Storing £ (pound sterling) sign and displaying in HTML email
        274939 by: Graham Cossey
        274942 by: Richard Heyes

Re: Storing £ (pound sterling) sign and displaying in HTML email
        274943 by: James Dempster

question, about mysql query
        274945 by: LKSunny

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]


----------------------------------------------------------------------
--- Begin Message --- I'm converting upper case characters in a string to lower case and am coming up with an empty string.

As I've done a million times before with other non-numerical strings.

$thisStr = "CL22";

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?

Thanks,

Ed



--- End Message ---
--- Begin Message ---
Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am coming up with an empty string.

As I've done a million times before with other non-numerical strings.

$thisStr = "CL22";

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?

Because you're echoing out the original (uppercase) string. Try:

echo $strLow;

--
              Richard Heyes

         In Cambridge? Employ me
        http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
|    http://www.phpguru.org/sftpdrive    |
+----------------------------------------+

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am coming up with an empty string.

As I've done a million times before with other non-numerical strings.

$thisStr = "CL22";

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?

Because you're echoing out the original (uppercase) string. Try:

echo $strLow;

//in my best yoda voice//

to quickly you answer before you think...

//back in the Milky Way...//

he should still see something.

the op should see the original string 'CL22'. Last time I looked strtolower() did not modify the input as a reference.

So   echo $thisStr; should result in the op seeing CL22

Unless there are other things happening that only the force knows about...

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


--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am coming up with an empty string.

As I've done a million times before with other non-numerical strings.

$thisStr = "CL22";

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?

Because you're echoing out the original (uppercase) string. Try:

echo $strLow;


My mistake. I meant to type echo $strLow; not echo $thisStr; in my post.

--- End Message ---
--- Begin Message ---
Does :

/echo strtolower("CL22");/

work?
You could also try :

/var_dump($strLow);

/

Ed Curtis wrote:
Richard Heyes wrote:
Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am coming up with an empty string.

As I've done a million times before with other non-numerical strings.

$thisStr = "CL22";

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?
My mistake. I meant to type echo $strLow; not echo $thisStr; in my post.


--- End Message ---
--- Begin Message ---
Michael Kubler wrote:
Does :

/echo strtolower("CL22");/

work?
You could also try :

/var_dump($strLow);

/

Ed Curtis wrote:
Richard Heyes wrote:
Ed Curtis wrote:
I'm converting upper case characters in a string to lower case and am coming up with an empty string.

As I've done a million times before with other non-numerical strings.

$thisStr = "CL22";

$strLow = strtolower($thisStr);

echo $thisStr;

Why does $strLow come up empty?
My mistake. I meant to type echo $strLow; not echo $thisStr; in my post.


I found the problem myself. The actual code follows the same principal but the value of $thisStr is a $_GET value from a link. The name of that value in the link was 'style'. Oops, you should never use a HTML reserved attribute as a varible identifier in a link. I just wasn't thinking at the time I wrote it. (<a href="order2.php"?style="CL22">)

Sorry I took up your time,

Ed
--- End Message ---
--- Begin Message ---

On 2-Jun-08, at 10:25 AM, Ed Curtis wrote:

I found the problem myself. The actual code follows the same principal but the value of $thisStr is a $_GET value from a link. The name of that value in the link was 'style'. Oops, you should never use a HTML reserved attribute as a varible identifier in a link. I just wasn't thinking at the time I wrote it. (<a href="order2.php"?style="CL22">)

Input validation is always a very important aspect when using values submitted by the client. Assuming that $_GET['style'] existed without testing for it was the first thing that should've been looked at.

In order to make maximum use of this mailing list, it's really helpful for us to see the _actual_ code you're using, rather than fake code. Your fake code had no problems, so we weren't able to provide you with a solution, but it sounds like your real code had the error that caused the problem.

Even in your latest post, you put this:
(<a href="order2.php"?style="CL22">)

What's with all of those double-quotes? More fake code, or is that actually what you have in your code?


~Ted

--- End Message ---
--- Begin Message ---
Yui Hiroaki wrote:
Please take a look at code.

--------a.php--------

$obj=new my("Hello");
$obj->buff();


Class my{

private $word;
function __construct($getword){
       $this->word=$getword;
}
public function buff(){
     echo $this->word."<br />";
}
--------------------------------------


-----b.php-----------------------

function __autoload($class_name) {
    include_once $class_name . '.php';
}


$objref=new my("Good");
$objref->buff();
--------------------------------------------



I get an Echo;

Good
Hello
Hello

I do not need to get Hello twice.

When I b.php , $obj=new my("Hello") is loaded.


Do you have any adia to avoid load $obj in a.php twice?

Regards,
Yui


Just to make sure, you are calling your a.php script my.php in real life right?

If not, this might be part of your problem. When I run the above script, and change the a.php to my.php, it loads just fine and it only displays one instance of hello. I am thinking that you calling the class more then once and you don't realize it.


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


--- End Message ---
--- Begin Message ---
if I delete
$obj=new my("Hello");
$obj->buff();

I can not show "Hello."

I would like to see "hello" one time only.

Regards,
Yui
2008/6/2 Scott McNaught [Synergy 8] <[EMAIL PROTECTED]>:
> Try removing from a.php the lines:
>
> $obj=new my("Hello");
> $obj->buff();
>
> I think this will achieve what you want.
>
> -----Original Message-----
> From: Yui Hiroaki [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 02, 2008 11:01 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Avoid object twice
>
> Please take a look at code.
>
> --------a.php--------
>
> $obj=new my("Hello");
> $obj->buff();
>
>
> Class my{
>
> private $word;
> function __construct($getword){
>       $this->word=$getword;
> }
> public function buff(){
>     echo $this->word."<br />";
> }
> --------------------------------------
>
>
> -----b.php-----------------------
>
> function __autoload($class_name) {
>    include_once $class_name . '.php';
> }
>
>
> $objref=new my("Good");
> $objref->buff();
> --------------------------------------------
>
>
>
> I get an Echo;
>
> Good
> Hello
> Hello
>
> I do not need to get Hello twice.
>
> When I b.php , $obj=new my("Hello") is loaded.
>
>
> Do you have any adia to avoid load $obj in a.php twice?
>
> Regards,
> Yui
>
> --
> 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
>
>

--- End Message ---
--- Begin Message ---
I don't see how it's possible for you to get "Hello" after "Good", when the
file that cause's "Hello" is required to do "Good"

/James

On Mon, Jun 2, 2008 at 2:00 PM, Yui Hiroaki <[EMAIL PROTECTED]> wrote:

> Please take a look at code.
>
> --------a.php--------
>
> $obj=new my("Hello");
> $obj->buff();
>
>
> Class my{
>
> private $word;
> function __construct($getword){
>       $this->word=$getword;
> }
> public function buff(){
>     echo $this->word."<br />";
> }
> --------------------------------------
>
>
> -----b.php-----------------------
>
> function __autoload($class_name) {
>    include_once $class_name . '.php';
> }
>
>
> $objref=new my("Good");
> $objref->buff();
> --------------------------------------------
>
>
>
> I get an Echo;
>
> Good
> Hello
> Hello
>
> I do not need to get Hello twice.
>
> When I b.php , $obj=new my("Hello") is loaded.
>
>
> Do you have any adia to avoid load $obj in a.php twice?
>
> Regards,
> Yui
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi phpers,

I'm having a strange problem. My goal is to be able to generate navigation buttons on the fly. I had this working -- I could pass variable text, size and font information to the php page that generates the image and all worked as expected--png files were created, stored and displayed on the page.

The only issue was that during the testing phase, I had hard coded the color of the button and the text.

        $im = imagecreate (168, $height);       
        $buttoncolor1 = imageColorAllocate ($im, 51, 51, 51);
        $navtextcolor1 = ImageColorAllocate ($im, 153, 153, 153);
        
$x = 160-$width;
ImageTTFText ($im, $textsize, 0, $x, 20, $navtextcolor1, $font, $name);
$handle = fopen ($filename, "w");
ImagePNG($im, $filename);

imagePNG($im);

imagedestroy($im);

This gave me a light gray button with dark gray text.

The next step was to be able to pass the button and text colors to the php page, as well.

        $im = imagecreate (168, $height);       
        $buttoncolor1 = imageColorAllocate ($im, $redb, $greenb, $blueb);
        $navtextcolor1 = ImageColorAllocate ($im, $redt, $greent, $bluet);
                                
$x = 160-$width;
ImageTTFText ($im, $textsize, 0, $x, 20, $navtextcolor1, $font, $name);
$handle = fopen ($filename, "w");
ImagePNG($im, $filename);

imagePNG($im);

imagedestroy($im);
}

The only thing that changed was to use variables in the imageColorAllocate function instead of entering actual numbers (I also added code to GET the color variables).

I no longer got any buttons -- just a series of question marks.

In case the problem was with the passing of the color numbers, I added the following lines just before the imagecreate function as a test:

                $redt = 51;
                $greent = 51;
                $bluet = 51;
                        
                $redb = 153;
                $greenb = 153;
                $blueb = 153;

That did not help.

The kicker is that the png images are being generated -- i find them in the folder where they are saved. But they do not appear on the page. When the color numbers are hardcoded they do appear.

Thanks for any help you can give with this.

Jo Ann
Jo Ann Comito
by Design
Complete Design & Production Services
For Print and Web
www.greatbydesign.com/



--- End Message ---
--- Begin Message ---
i have a registration page called register.php if the data entered is
validated correctly i call a file called thankyou.php or else validate.php



presently a user after seeing the url website.com/thankyou.php if they enter
the url directly in the browser as website.com/thankyou.php they can access
the file, if a user accesses the file this way i would like to redirect to a
page saying "Direct acess to this file is not allowed"



previously i used sessions in register.php and also in thakyou.php and
validate.php and it worked fine for some reason now it is not working the
way it is supposed to i might have made some changes which i do not know



previously my code in register.php was,  the first few lines of register.php
file

=====================================================================

<?php

ob_start();

session_start();

if(!session_is_registered("directaccess"))

{

session_register("directaccess");

}

// rest of the html and php code

ob_end_flush();

?>

=====================================================================

code in thankyou.php, the first few lines of register.php file

=====================================================================

<?php

session_start();

if(!session_is_registered("directaccess"))

{

header("Location: http://website.com/directaccess.html";);

exit;

}

// rest of the html and php code

ob_end_flush();

?>

=====================================================================

NOTE = in thankyou.php i display a thank you message by retrieving the first
name from register page and displaying in thankyou.php using session
variables in the following way



in register.php, the first few lines of register.php file

=====================================================================

if(!session_is_registered("firstname"))

{

session_register("firstname ");

}

$_SESSION[firstname] = $ firstname;

=====================================================================



in thankyou.php, the first few lines of register.php file

=====================================================================

if(session_is_registered("firstname "))

{

echo $_SESSION[firstname];

session_unregister("firstname ");

}

=====================================================================

please advice how i should rewrite the php code in both the
files(register.php and thankyou.php) so that if a user enters the url
directly in the browser i can redirect to directaccess.html file



thanks.

--- End Message ---
--- Begin Message ---

How are you "calling thankyou.php"?

1. are you -redirecting- the user to that file?
 --or--
2. are you -including- that file into register.php upon a successful submission?

The method you're using determines how you best secure thankyou.php from direct access.

If you're redirecting, then using a session variable is what you want.
If you're including, then a simple constant or variable defined in register.php can be checked and validated in thankyou.php.

NOTE: use of session_register() is deprecated. After calling session_start(), just assign variables directly to $_SESSION:

$_SESSION['firstname'] = 'Fred;


~Ted




On 2-Jun-08, at 11:12 AM, Sudhakar wrote:

i have a registration page called register.php if the data entered is
validated correctly i call a file called thankyou.php or else validate.php



presently a user after seeing the url website.com/thankyou.php if they enter the url directly in the browser as website.com/thankyou.php they can access the file, if a user accesses the file this way i would like to redirect to a
page saying "Direct acess to this file is not allowed"



previously i used sessions in register.php and also in thakyou.php and
validate.php and it worked fine for some reason now it is not working the way it is supposed to i might have made some changes which i do not know



previously my code in register.php was, the first few lines of register.php
file

=====================================================================

<?php

ob_start();

session_start();

if(!session_is_registered("directaccess"))

{

session_register("directaccess");

}

// rest of the html and php code

ob_end_flush();

?>

=====================================================================

code in thankyou.php, the first few lines of register.php file

=====================================================================

<?php

session_start();

if(!session_is_registered("directaccess"))

{

header("Location: http://website.com/directaccess.html";);

exit;

}

// rest of the html and php code

ob_end_flush();

?>

=====================================================================

NOTE = in thankyou.php i display a thank you message by retrieving the first
name from register page and displaying in thankyou.php using session
variables in the following way



in register.php, the first few lines of register.php file

=====================================================================

if(!session_is_registered("firstname"))

{

session_register("firstname ");

}

$_SESSION[firstname] = $ firstname;

=====================================================================



in thankyou.php, the first few lines of register.php file

=====================================================================

if(session_is_registered("firstname "))

{

echo $_SESSION[firstname];

session_unregister("firstname ");

}

=====================================================================

please advice how i should rewrite the php code in both the
files(register.php and thankyou.php) so that if a user enters the url
directly in the browser i can redirect to directaccess.html file



thanks.


--- End Message ---
--- Begin Message ---
   Hello All, my first time here at list.

   Well, I am with a very weird question, never happened with me,
always worked fine.

   First of all, I am using WAMP (php 5.2.6, apache 2.2.8, mysql
5.0.51b), Firefox (All
cookies allowed), Windows XP SP 3 (I think ;-)... Ah, the
"session.save_path" property is pointing
to a valid path and the session files are been created there. The
"session.cookie_domain" I leave
in blank, as I saw in other forum.

   That code below is not working properly. First time it creates the
session and show me
"First activation etc etc". If I press CTRL-R (Firefox, but I tested
in IE too), it gets the same
session, showing me the next number.

   If I press First Link (Again 1), it creates a NEW SESSION, when It
would get the old one. And now,
every CTRL-R is getting me a new session. Only If I go at address bar
and hit ENTER, I can get
the very first session created.

   The second link (Again 2) is a test. I saw that, if I set:

session.use_only_cookies=0
session.use_trans_sid=1

   this link works fine. But, I don't want to pass Session ID every
link. I tried to set the properties above
in other ways, but I get the same behavior: session lost in every link click.

   Could someone execute this script, to see if it has some wrong?

   Could you please help me...

         Thank you in advance.

                     Razer.

<?php
session_start();
if (!isset($_SESSION['test'])) {
  echo "First activation: setting session variable";
  $_SESSION['test'] = 1;
} else {
  echo "SESSIONS ARE WORKING! activation: ", (++$_SESSION['test']);
?>
<br><a href="http://localhost:8081/testesession.php";>Again 1</a>
<br>
<br><a href="http://localhost:8081/testesession.php?<?php echo
session_name().'='.session_id();?>">Again 2</a>
<?php
}
echo "<br>" . session_id() . "<br><br>";
?>

--
________________________________
Razer Anthom Nizer Rojas Montaño

--- End Message ---
--- Begin Message ---

1. If you're using cookies, there's no need to pass the session name via the URL.
2. Is the cookie being created?

~Ted



On 2-Jun-08, at 11:32 AM, Razer Montaño wrote:

 Hello All, my first time here at list.

 Well, I am with a very weird question, never happened with me,
always worked fine.

 First of all, I am using WAMP (php 5.2.6, apache 2.2.8, mysql
5.0.51b), Firefox (All
cookies allowed), Windows XP SP 3 (I think ;-)... Ah, the
"session.save_path" property is pointing
to a valid path and the session files are been created there. The
"session.cookie_domain" I leave
in blank, as I saw in other forum.

 That code below is not working properly. First time it creates the
session and show me
"First activation etc etc". If I press CTRL-R (Firefox, but I tested
in IE too), it gets the same
session, showing me the next number.

 If I press First Link (Again 1), it creates a NEW SESSION, when It
would get the old one. And now,
every CTRL-R is getting me a new session. Only If I go at address bar
and hit ENTER, I can get
the very first session created.

 The second link (Again 2) is a test. I saw that, if I set:

session.use_only_cookies=0
session.use_trans_sid=1

 this link works fine. But, I don't want to pass Session ID every
link. I tried to set the properties above
in other ways, but I get the same behavior: session lost in every link click.

 Could someone execute this script, to see if it has some wrong?

 Could you please help me...

       Thank you in advance.

                   Razer.

<?php
session_start();
if (!isset($_SESSION['test'])) {
echo "First activation: setting session variable";
$_SESSION['test'] = 1;
} else {
echo "SESSIONS ARE WORKING! activation: ", (++$_SESSION['test']);
?>
<br><a href="http://localhost:8081/testesession.php";>Again 1</a>
<br>
<br><a href="http://localhost:8081/testesession.php?<?php echo
session_name().'='.session_id();?>">Again 2</a>
<?php
}
echo "<br>" . session_id() . "<br><br>";
?>

--
________________________________
Razer Anthom Nizer Rojas Montaño

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



--- End Message ---
--- Begin Message ---
   Yes, the cookie is being created. I show it in Firefox (Tools |
Options | Privacy | Show Coockies).

   So the Session File, is being created at "session.save_path", as
configured in PHP.INI.

        :(

    Thank you for your response.


2008/6/2 Ted Wood <[EMAIL PROTECTED]>:
>
> 1. If you're using cookies, there's no need to pass the session name via the
> URL.
> 2. Is the cookie being created?
>
> ~Ted
>
>
>
> On 2-Jun-08, at 11:32 AM, Razer Montaño wrote:
>
>>  Hello All, my first time here at list.
>>
>>  Well, I am with a very weird question, never happened with me,
>> always worked fine.
>>
>>  First of all, I am using WAMP (php 5.2.6, apache 2.2.8, mysql
>> 5.0.51b), Firefox (All
>> cookies allowed), Windows XP SP 3 (I think ;-)... Ah, the
>> "session.save_path" property is pointing
>> to a valid path and the session files are been created there. The
>> "session.cookie_domain" I leave
>> in blank, as I saw in other forum.
>>
>>  That code below is not working properly. First time it creates the
>> session and show me
>> "First activation etc etc". If I press CTRL-R (Firefox, but I tested
>> in IE too), it gets the same
>> session, showing me the next number.
>>
>>  If I press First Link (Again 1), it creates a NEW SESSION, when It
>> would get the old one. And now,
>> every CTRL-R is getting me a new session. Only If I go at address bar
>> and hit ENTER, I can get
>> the very first session created.
>>
>>  The second link (Again 2) is a test. I saw that, if I set:
>>
>> session.use_only_cookies=0
>> session.use_trans_sid=1
>>
>>  this link works fine. But, I don't want to pass Session ID every
>> link. I tried to set the properties above
>> in other ways, but I get the same behavior: session lost in every link
>> click.
>>
>>  Could someone execute this script, to see if it has some wrong?
>>
>>  Could you please help me...
>>
>>       Thank you in advance.
>>
>>                   Razer.
>>
>> <?php
>> session_start();
>> if (!isset($_SESSION['test'])) {
>> echo "First activation: setting session variable";
>> $_SESSION['test'] = 1;
>> } else {
>> echo "SESSIONS ARE WORKING! activation: ", (++$_SESSION['test']);
>> ?>
>> <br><a href="http://localhost:8081/testesession.php";>Again 1</a>
>> <br>
>> <br><a href="http://localhost:8081/testesession.php?<?php echo
>> session_name().'='.session_id();?>">Again 2</a>
>> <?php
>> }
>> echo "<br>" . session_id() . "<br><br>";
>> ?>
>>
>> --
>> ________________________________
>> Razer Anthom Nizer Rojas Montaño
>>
>> --
>> 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
>
>



-- 
________________________________
Razer Anthom Nizer Rojas Montaño

--- End Message ---
--- Begin Message ---
I was working on a project for XML Parsing. I came across instances where my
elements were completely missing.

After further Digging into the issue, I found out, that when placing tags
inside of an element with text, SimpleXML (and dom Document) ignore the
added tags, and the text within.

Heres an example.

-----------ok.xml-----------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Document>
        <Article>
                <Title pagenum="84" docname="Career Path mar 08">Is Your
Face on Facebook? </Title>
                <Subtitle>Employ simple strategies to market your ?profile?
using online social networking.</Subtitle>
                <Body>Temp Testing Example of SimpleXML Bug.<b>Is it a bug
though?</b></Body>
                <Folio>Trying to just show Examples</Folio>
        </Article>
</Document>
-----------ok.xml-----------------

-----------ok.php-----------------
<?php

$file = file_get_contents('ok.xml');
$xml = new SimpleXMLElement($file);

print_r($xml);
print $xml->Article->Body->b . "\n";
-----------ok.php-----------------


-----------output-----------------
SimpleXMLElement Object
(
    [Article] => SimpleXMLElement Object
        (
            [Title] => Is Your Face on Facebook?
            [Subtitle] => Employ simple strategies to market your ?profile?
using online social networking.
            [Body] => Temp Testing Example of SimpleXML Bug.
            [Folio] => Trying to just show Examples
        )

)
Is it a bug though?
-----------output-----------------




Furthermore if I place <b> tags at the beginning of of the <Body> tags
ie.

<Body><b>Testing</b>Temp Testing Example of SimpleXML Bug.<b>Is it a bug
though?</b></Body>

The text between the </b> and <b> is ignored and is output as follows..

-----------output---------------
SimpleXMLElement Object
(
    [Article] => SimpleXMLElement Object
        (
            [Title] => Is Your Face on Facebook?
            [Subtitle] => Employ simple strategies to market your ?profile?
using online social networking.
            [Body] => SimpleXMLElement Object
                (
                    [b] => Array
                        (
                            [0] => Testing
                            [1] => Is it a bug though?
                        )

                )

            [Folio] => Trying to just show Examples
        )

)
Testing
-----------output---------------

The above output is using ok.php.

Is this working as intended?

--- End Message ---
--- Begin Message ---
On Mon, Jun 2, 2008 at 3:12 PM, Kyle Browning <[EMAIL PROTECTED]> wrote:

> I was working on a project for XML Parsing. I came across instances where
> my
> elements were completely missing.
>
> After further Digging into the issue, I found out, that when placing tags
> inside of an element with text, SimpleXML (and dom Document) ignore the
> added tags, and the text within.
>

thats a known limitation. i have written a workaround in some code for a
personal project, but it cant be great for performance.  anyway, another
option is to use DOM.


> -----------output-----------------
> SimpleXMLElement Object
> (
>    [Article] => SimpleXMLElement Object
>        (
>            [Title] => Is Your Face on Facebook?
>            [Subtitle] => Employ simple strategies to market your ?profile?
> using online social networking.
>            [Body] => Temp Testing Example of SimpleXML Bug.
>            [Folio] => Trying to just show Examples
>        )
>
> )


are you using print_r() or var_dump() to generate this output?  fyi, those
are explicitly not supported by simplexml.

-nathan

--- End Message ---
--- Begin Message ---
On Mon, Jun 2, 2008 at 4:32 PM, Kyle Browning <[EMAIL PROTECTED]> wrote:

> I used both print_r and var_dump.
> Whats supported for ultimate nesting prints of values and keys?, or in
> objects words, properties and values.
>

cc'ng the list again..

well var_dump() and print_r() just arent supported for simplexml, per the
manual,

http://php.oregonstate.edu/manual/en/function.simplexml-element-attributes.php

*Note*: SimpleXML has made a rule of adding iterative properties to most
methods. They cannot be viewed using
var_dump()<http://php.oregonstate.edu/manual/en/function.var-dump.php>or
anything else which can examine objects.

basically, youre best bet w/ simplexml is asXML() ;)

-nathan

--- End Message ---
--- Begin Message ---
Could someone please point me in the right direction here please?

I have a form textarea field (submitted using POST) that accepts free
text that will include the likes of '£' (pound sterling symbol) that
is written to a MySql database and later retrieved to output into an
HTML email.

I have been experimenting with htmlentities, htmlspecialchars and
addslashes but still have the problem whereby I get "&ACirc;"
preceeding the "&pound;"

Could someone kindly suggest what I'm doing wrong and what function(s)
I should be looking into?

Thanks

-- 
Graham

--- End Message ---
--- Begin Message ---
Graham Cossey wrote:
Could someone please point me in the right direction here please?

I have a form textarea field (submitted using POST) that accepts free
text that will include the likes of '£' (pound sterling symbol) that
is written to a MySql database and later retrieved to output into an
HTML email.

I have been experimenting with htmlentities, htmlspecialchars and
addslashes but still have the problem whereby I get "&ACirc;"
preceeding the "&pound;"

Could someone kindly suggest what I'm doing wrong and what function(s)
I should be looking into?

You could just store the amount numerically (and optionally the currency if need be) and just put the &pound; in your HTML file.

--
              Richard Heyes

         In Cambridge? Employ me
        http://www.phpguru.org/cv

+----------------------------------------+
| Access SSH with a Windows mapped drive |
|    http://www.phpguru.org/sftpdrive    |
+----------------------------------------+

--- End Message ---
--- Begin Message ---
This is most likely a character encoding issue. Check that the html encoding
is set to the same type as what your storing it as in mysql.

/James

On Mon, Jun 2, 2008 at 10:26 PM, Graham Cossey <[EMAIL PROTECTED]>
wrote:

> Could someone please point me in the right direction here please?
>
> I have a form textarea field (submitted using POST) that accepts free
> text that will include the likes of '£' (pound sterling symbol) that
> is written to a MySql database and later retrieved to output into an
> HTML email.
>
> I have been experimenting with htmlentities, htmlspecialchars and
> addslashes but still have the problem whereby I get "&ACirc;"
> preceeding the "&pound;"
>
> Could someone kindly suggest what I'm doing wrong and what function(s)
> I should be looking into?
>
> Thanks
>
> --
> Graham
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
two table, tablea and tableb
tablea
uid, col1, col2, col3
1,    xx, xx, xx
2,    xx, xx, xx
3,    xx, xx, xx
tableb
id, uid, col1, firstdata
1, 1, xx, 1
2, 2, xx, 0
3, 2, xx, 0
4, 1, xx, 0

i want query tablea, and join tableb, uid is associate, ok "LEFT JOIN 
`tableb` b ON a.uid = b.uid", and than i want tableb firstdata=1 or tableb 
no associate uid "b.firstdata=1 OR b.uid IS NULL", by the time all ok, but i 
want add one case, if tableb firstdata all is 0, result one row, like b.uid 
IS NULL, i don't know how to

i want result is all tablea data no double, tableb one case firstdata is 1 
(one uid in tableb just one row possible is firstdata=1), or no row in 
tableb, or all firstdata = 0

Thank You Very Much !!

This query can't
SELECT a.*, b.* FROM `tablea` a LEFT JOIN `tableb` b ON a.uid = b.uid WHERE 
(b.firstdata=1 OR b.firstdata=0 OR b.uid IS NULL) 



--- End Message ---

Reply via email to