v5:userguide:deprecated
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:userguide:deprecated [2016/03/14 00:37] – mnewnham | v5:userguide:deprecated [2018/06/27 16:16] (current) – function names starting with lowercase (#430) dregad | ||
---|---|---|---|
Line 5: | Line 5: | ||
<code php> | <code php> | ||
- | |||
include(' | include(' | ||
+ | $conn = & | ||
+ | $conn-> | ||
+ | $sql = ' | ||
+ | $rs = $conn-> | ||
+ | print $rs-> | ||
+ | </ | ||
- | $conn = & | + | Here we define a menu named GetCust, with the menu option |
- | $conn-> | + | ===== Example 9: Exporting in CSV or Tab-Delimited Format ===== |
- | $sql = ' | + | We provide some helper functions to export in comma-separated-value (CSV) and tab-delimited formats: |
- | $rs = $conn->Execute($sql); | + | <code php> |
- | print $rs-> | + | include_once('/ |
+ | include_once('/ | ||
+ | $db = & | ||
+ | $db-> | ||
+ | |||
+ | $rs = $db-> | ||
+ | |||
+ | print "< | ||
+ | print rs2csv($rs); | ||
+ | print '< | ||
+ | |||
+ | $rs-> | ||
+ | print rs2tab($rs, | ||
+ | # false == suppress field names in first line | ||
+ | print '< | ||
+ | |||
+ | $rs-> | ||
+ | |||
+ | rs2tabout($rs); | ||
+ | |||
+ | print "</ | ||
+ | |||
+ | $rs-> | ||
+ | $fp = fopen($path, | ||
+ | if ($fp) { | ||
+ | rs2csvfile($rs, | ||
+ | fclose($fp); | ||
+ | } | ||
</ | </ | ||
- | Here we define a menu named GetCust, with the menu option 'Mary Rosli' selected. See GetMenu(). We also have functions that return the recordset as an array: GetArray(), | + | Carriage-returns or newlines are converted to spaces. Field names are returned in the first line of text. Strings containing the delimiter character are quoted with double-quotes. Double-quotes are double-quoted again. This conforms to Excel import |
+ | All the above functions take as an optional last parameter, $addtitles which defaults to true. When set to false field names in the first line are suppressed. |
v5/userguide/deprecated.1457912273.txt.gz · Last modified: 2017/04/21 11:39 (external edit)