BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


LAMP
Mysql Data Manager
Control Structures
What is the CreateEventSource method?
What is the CreateEventSource method?


 
 

<< JavaScriptMicrosoft ASP >>


By Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First Posted 12/21/2001
Times viewed 942

Return mySQL queries normally or as xml


Summary Function to encapsulate a mySQL query and optionally return the result as xml.

Return mySQL queries normally or as xml

Function to encapsulate a mySQL query and optionally return the result as xml.

This function consists of several parts:

  • Connect to the server
  • Select the appropriate database
  • Execute the query
  • Loop through the results and build appropriate xml
  • Return the xml as a string

This function produces xml in the following format

<table_name>
   <row>
      <fieldname>value</fieldname>
   </row>
</table_name>

Usage: $result = safequery(SQL Query, Database name, true/false);

based on code written by Jay Greenspan in his book MySQL/PHP Database Applications New York: M&T Books, 2001.

Additional information


<< JavaScriptMicrosoft ASP >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML