Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP and Spry

Explorer ,
Sep 05, 2007 Sep 05, 2007
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
TOPICS
Server side applications
257
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 05, 2007 Sep 05, 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 evalua...
Translate
LEGEND ,
Sep 05, 2007 Sep 05, 2007
LATEST
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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines