Skip to main content
Participant
September 5, 2007
Answered

PHP and Spry

  • September 5, 2007
  • 1 reply
  • 280 views
Prior to XML I used to simply use PHP to execute a MySQL query, get the result and do something with it. Sometimes this would mean I could evaluate the returning value and, depending on its parameters, I could do something; like not display it. How can I do this with an XML dataset?

My current issue: I am querying the database for address info. There are 2 fields, address1 and address2. Not every record has a value in address 2 - so if I simply drag out the data elements onto the app, and there is no value, the result is a null line. It would look like this:

FirstName LastName
123 Some Road

SomeCity CA, 99999

When I want this if there is no value in address2:
FirstName LastName
123 Some Road
SomeCity CA, 99999

Prior to utilizing the XML, I would simply evaluate the returned data element using php, but I don't know how, or if, php can evaluate a returning xml value.

Thanks for any help - and if I am missing something that is really obvious; sorry.
-jacob
This topic has been closed for replies.
Correct answer Newsgroup_User
jmortimer wrote:
> Prior to XML I used to simply use PHP to execute a MySQL query, get the result
> and do something with it. Sometimes this would mean I could evaluate the
> returning value and, depending on its parameters, I could do something; like
> not display it. How can I do this with an XML dataset?

You need to add a Spry conditional to the element that might contain an
empty string:

<p spry:if="'{address2}' != ''">{address2}</p>

> Prior to utilizing the XML, I would simply evaluate the returned data element
> using php, but I don't know how, or if, php can evaluate a returning xml value.

PHP normally has nothing to do with the display of Spry data sets.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

1 reply

Newsgroup_UserCorrect answer
Inspiring
September 5, 2007
jmortimer wrote:
> Prior to XML I used to simply use PHP to execute a MySQL query, get the result
> and do something with it. Sometimes this would mean I could evaluate the
> returning value and, depending on its parameters, I could do something; like
> not display it. How can I do this with an XML dataset?

You need to add a Spry conditional to the element that might contain an
empty string:

<p spry:if="'{address2}' != ''">{address2}</p>

> Prior to utilizing the XML, I would simply evaluate the returned data element
> using php, but I don't know how, or if, php can evaluate a returning xml value.

PHP normally has nothing to do with the display of Spry data sets.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/