php-general Digest 20 Feb 2009 23:06:14 -0000 Issue 5970

Topics (messages 288630 through 288637):

Re: Two troublesome fields
        288630 by: Sean DeNigris

XML -> XSLT transformation using XSLTProcessor class
        288631 by: German Geek
        288634 by: Boyd, Todd M.
        288635 by: German Geek

mobile texting app question
        288632 by: Bastien Koert

Re: Zend Guard/Optimizer alternatives?
        288633 by: Jochem Maas

Re: Unique User Hashes
        288636 by: Nathan Rixham
        288637 by: Michael A. Peters

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 ---
From: Terion Miller <[email protected]>
Date: February 19, 2009 5:34:50 PM EST
To: Bastien Koert <[email protected]>
Cc: PHP General <[email protected]>
Subject: Re: [PHP] Two troublesome fields
I just tried this and now it's not inserting at all where before everything
EXCEPT two fields go in...

$sql = "INSERT INTO workorders ( CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes) VALUES (";

   $sql .= "Now(), ";
   $sql .= "'". mysql_real_escape_string($Location) ."', ";
   $sql .= "'". mysql_real_escape_string($WorkOrderName) ."', ";
   $sql .= "'". mysql_real_escape_string($AdminID) ."', ";
   $sql .= "'". mysql_real_escape_string("WorkOrder") ."', ";
   $sql .= "'". mysql_real_escape_string("New Order") ."', ";
   $sql .= "'". mysql_real_escape_string($Notes) ."', ";

   $WorkOrderID = mysql_insert_id();
   mysql_query($sql);

There's no closing parethesis to VALUES, try...
        $sql .= "'". mysql_real_escape_string($Notes) ."')";

Sean DeNigris
[email protected]

--- End Message ---
--- Begin Message ---
Hi All,

We are trying to import some xml data into the database. My idea was to make
an xslt and then transform the xml to php code which generates the queries
necessary and then gets evaled as php code for the actual import...

Anyway, i got it working (mostly)!

But i need to get the current element name with x-path. So i have the
following:

<rootEl>
  <elementA><childOfA>some data 1</childOfA></elementA>
  <elementB><childOfB>some data 2</childOfB></elementB>
  <elementB><childOfB>some data 3</childOfB></elementB>
  <elementA><childOfA>some data 4</childOfA></elementA>
  <elementA><childOfA>some data 5</childOfA></elementA>
</rootEl>

<xsl:for-each select="//elementA | //elementB">
  // <xsl:value-of select="childOfA" /> WORKS and gives the value of
childOfA (e.g. some data 1)
  //... the php code...
</xsl:for-each>

In the php code, I need to get the element tag name of the current element,
so either elementA or elementB. How can i get that in an x-path expression?

I know, this is not strictly a php question, but since the project is in php
and this list has a very good response rate, i decided to ask here. I
already looked on the web for hours, but maybe i just don't have the right
keywords.

Please help. Thanks.

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
P. J. O'Rourke  - "Everybody knows how to raise children, except the people
who have them."

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of
> German Geek
> Sent: Friday, February 20, 2009 9:18 AM
> To: PHP General list
> Subject: [PHP] XML -> XSLT transformation using XSLTProcessor class
> 
> Hi All,
> 
> We are trying to import some xml data into the database. My idea was to
> make
> an xslt and then transform the xml to php code which generates the
> queries
> necessary and then gets evaled as php code for the actual import...
> 
> Anyway, i got it working (mostly)!
> 
> But i need to get the current element name with x-path. So i have the
> following:
> 
> <rootEl>
>   <elementA><childOfA>some data 1</childOfA></elementA>
>   <elementB><childOfB>some data 2</childOfB></elementB>
>   <elementB><childOfB>some data 3</childOfB></elementB>
>   <elementA><childOfA>some data 4</childOfA></elementA>
>   <elementA><childOfA>some data 5</childOfA></elementA>
> </rootEl>
> 
> <xsl:for-each select="//elementA | //elementB">
>   // <xsl:value-of select="childOfA" /> WORKS and gives the value of
> childOfA (e.g. some data 1)
>   //... the php code...
> </xsl:for-each>
> 
> In the php code, I need to get the element tag name of the current
> element,
> so either elementA or elementB. How can i get that in an x-path
> expression?
> 
> I know, this is not strictly a php question, but since the project is
> in php
> and this list has a very good response rate, i decided to ask here. I
> already looked on the web for hours, but maybe i just don't have the
> right
> keywords.
> 
> Please help. Thanks.

I believe the name() XPath function is what you are looking for. It's been a 
while since I've worked with XPath query strings, but I believe ".[name()]" 
will get you the current element's tag name. Keep in mind: I'm not sure if this 
works with namespaced tags (like <namespace:tagname />), but I have not tested 
this to be sure.

HTH,


// Todd

--- End Message ---
--- Begin Message ---
Thanks a lot. Sorry but 5 minutes after sending this email i figured it out
myself. I didn't know how to answer my own message because i didn't get my
own message... Anyway, this worked for me:

<xsl:for-each select="//elementA | //elementB">
  <xsl:value-of select="name(.)" />
</xsl:for-each>

Hope this helps someone else...

Thanks again.

Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
Bill Watterson  - "There is not enough time to do all the nothing we want to
do."

2009/2/21 Boyd, Todd M. <[email protected]>

> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]] On Behalf Of
> > German Geek
> > Sent: Friday, February 20, 2009 9:18 AM
> > To: PHP General list
> > Subject: [PHP] XML -> XSLT transformation using XSLTProcessor class
> >
> > Hi All,
> >
> > We are trying to import some xml data into the database. My idea was to
> > make
> > an xslt and then transform the xml to php code which generates the
> > queries
> > necessary and then gets evaled as php code for the actual import...
> >
> > Anyway, i got it working (mostly)!
> >
> > But i need to get the current element name with x-path. So i have the
> > following:
> >
> > <rootEl>
> >   <elementA><childOfA>some data 1</childOfA></elementA>
> >   <elementB><childOfB>some data 2</childOfB></elementB>
> >   <elementB><childOfB>some data 3</childOfB></elementB>
> >   <elementA><childOfA>some data 4</childOfA></elementA>
> >   <elementA><childOfA>some data 5</childOfA></elementA>
> > </rootEl>
> >
> > <xsl:for-each select="//elementA | //elementB">
> >   // <xsl:value-of select="childOfA" /> WORKS and gives the value of
> > childOfA (e.g. some data 1)
> >   //... the php code...
> > </xsl:for-each>
> >
> > In the php code, I need to get the element tag name of the current
> > element,
> > so either elementA or elementB. How can i get that in an x-path
> > expression?
> >
> > I know, this is not strictly a php question, but since the project is
> > in php
> > and this list has a very good response rate, i decided to ask here. I
> > already looked on the web for hours, but maybe i just don't have the
> > right
> > keywords.
> >
> > Please help. Thanks.
>
> I believe the name() XPath function is what you are looking for. It's been
> a while since I've worked with XPath query strings, but I believe
> ".[name()]" will get you the current element's tag name. Keep in mind: I'm
> not sure if this works with namespaced tags (like <namespace:tagname />),
> but I have not tested this to be sure.
>
> HTH,
>
>
> // Todd
>

--- End Message ---
--- Begin Message ---
All,

I am working on the design for an app that uses mobile phone texting to make
payments, but I am having some trouble finding out how the whole mobile
process works. I grow the CSC (common short code) set up and them acting as
a clearing house, but can anyone point me to some docs on how the process
works. From the user attempting to text a payment to my site getting the
data?

Its kinda off topic, other than the entire site / app will be php based.
Googling doesn't get me that far, but it might be more of a not knowing
exactly what its called to be able to narrow the search.

Appreciate any replies.

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
Brian Dunning schreef:
> I should mention that I did try the ionCube online encoder, which I
> think is a great idea... but its runtimes failed to load on both of my
> test systems, requiring editing of php.ini. That's over the top for my
> users. I need something that's rock-solid and that will never require my
> users to have to know anything or do anything special (they are business
> people, not developers or server admins).

use a legal contract.
or make the functionality dependent on a webservice hosted on
your server (and stick the meat of the functionality on your end).
or get a client you can trust not to rape you.

> On Feb 16, 2009, at 9:10 AM, Brian Dunning wrote:
> 
>> Is there a cheaper alternative to Guard/Optimizer? I have a single
>> small PHP file that is part of a larger solution I sell, and I want it
>> to be protected - and it has to be a runtime so it will run on
>> anyone's standard PHP server. Zend's $600 was a little bit of sticker
>> shock. Any alternatives?
> 
> 
> 
> 


--- End Message ---
--- Begin Message ---
Martin Zvarík wrote:
Ashley Sheridan napsal(a):
On Thu, 2009-02-19 at 23:34 +0100, Martin Zvarík wrote:
Chris napsal(a):
Martin Zvarík wrote:
Chris napsal(a):
Martin Zvarík wrote:
tedd napsal(a):
At 5:28 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 5:10 PM +0100 2/19/09, Martin Zvarík wrote:
tedd napsal(a):
At 1:49 AM +0100 2/19/09, Martin Zvarík wrote:
Guys, I have not seen a poll where you need to input your email address - and if I would I would not vote - because it's a waste of my time... if you want me to vote you do everything you can to make it as pleasant as possible -- certainly that isn't requirement of an email validation.
Btw. google "free temporary email address" to see how unique email addresses really are - in case you meant it in reference to the poll voting - where you care about uniqueness of votes = people.
So instead of trolling, offer a better suggestion.
Chris, if you would read the whole thread (my first comment), I bet you would consider more wisely your patronizing comment.
"Use the ip" - which we've all said is useless.
Where's the better suggestion?
Nevermind, I was wrong - thank you for making me realize I am wasting time here.

This useless IP solution is used by 80% of websites. I was trying to convice you that requirement of an email validation is just, let's say, unwise. So, don't bark if you don't agree.
So you;'e saying that unless we agree with you, not to mention anything?


Ash
www.ashleysheridan.co.uk
I meant: You don't have to bark, if you don't agree. = We can discuss.


it's all a bit pointless, the only way to ensure only one vote per person is to get take and test a dns sample from each user.

anything else is going to be flawed

--- End Message ---
--- Begin Message ---
Nathan Rixham wrote:



it's all a bit pointless, the only way to ensure only one vote per person is to get take and test a dns sample from each user.

anything else is going to be flawed


Hey now, what do you have against us clones?
;)

--- End Message ---

Reply via email to