GSAK (Geocaching Swiss Army Knife)
 

Contents - Index


SqlToHtml (function)

SqlToHtml(sSqlData, sHeading, sOptions) : string

This function provides a quick and easy way to view sql data.

sSqlData - The resulting string of a GSAK SQL Query
sHeading - The heading for the HTML generated table
sOptions - Comma delimited options. Y= display result in browser (anything else just returns the HTML code)

The return result is the generated html code. You would normally include the Y option just to display the HTML so the result can usually be ignored, but is provided so you can save to a file or further manipulate.

Example:
 

# get the sql data to display
$result = sqlite("sql","Select ltype as LogType, count(ltype) as Total  from logs  GROUP by logtype ORDER by logtype","Headings=Yes")

# display the data
$html = sqltohtml($result,"Summary by log type","y")

 
This should open up a report in your browser that looks something like:



This generated report allows you to sort any column by clicking on the column heading

Alpha List         Category List
Copyright 2004-2011 CWE Computer Services  
Privacy Policy Contact