v5:userguide:learn_abstraction:basic_query
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
v5:userguide:learn_abstraction:basic_query [2016/03/15 01:15] – created mnewnham | v5:userguide:learn_abstraction:basic_query [2016/03/15 14:27] (current) – mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <- v5: | ||
+ | ~~NOTOC~~ | ||
====== A Basic Query ====== | ====== A Basic Query ====== | ||
+ | The simplest way that ADOdb can retrieve data is through the [[v5: | ||
+ | |||
+ | <code php> | ||
+ | $sql = " | ||
+ | $array = $db-> | ||
+ | |||
+ | print_r($array); | ||
+ | |||
+ | /* | ||
+ | * Returns | ||
+ | */ | ||
+ | 0 => array(' | ||
+ | ' | ||
+ | ' | ||
+ | ), | ||
+ | 1 => array(' | ||
+ | ' | ||
+ | ' | ||
+ | | ||
+ | 2 => array(' | ||
+ | ' | ||
+ | ' | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ===== Changing How Data Is Returned ===== | ||
+ | The array can be returned in one of 3 ways: numeric, associative or mixed. The example above shows the returned data in associative format. In numeric format, the same array would look like this: | ||
+ | |||
+ | <code php> | ||
+ | 0 => array(0 => 1000, | ||
+ | 1 => 'Joe Smith', | ||
+ | 2 => ' | ||
+ | ), | ||
+ | 1 => array(0 => 1001, | ||
+ | 1 => 'Fred Jones', | ||
+ | 2 => ' | ||
+ | | ||
+ | 2 => array(0 => 1002, | ||
+ | 1 => ' | ||
+ | 2 => ' | ||
+ | | ||
+ | </ | ||
+ | |||
+ | For more information on setting the returned data format, see [[v5: | ||
+ | |||
+ | ===== Alternative Commands ===== | ||
+ | There are a number of similar commands that can be used as coding shortcuts. For an exhaustive list, see the [[v5: | ||
+ | ^Command^Description| | ||
+ | |[[v5: | ||
+ | |[[v5: | ||
+ | |[[v5: |
v5/userguide/learn_abstraction/basic_query.1458000926.txt.gz · Last modified: 2017/04/21 11:40 (external edit)