PHP: Hypertext Preprocessor (original) (raw)
cubrid_result
(PECL CUBRID >= 8.3.0)
cubrid_result — Return the value of a specific field in a specific row
Description
This function returns the value of a specific field in a specific row from a result set.
Parameters
result
result
comes from a call to cubrid_execute()
row
The row number from the result that is being retrieved. Row numbers start at 0.
field
The name or offset of the field
being retrieved. It can be the field's offset, the field's name, or the field's table dot field name (tablename.fieldname). If the column name has been aliased ('select foo as bar from...'), use the alias instead of the column name. If undefined, the first field is retrieved.
Return Values
Value of a specific field, on success (NULL if value if null).
[false](reserved.constants.php#constant.false)
on failure.
Examples
Example #1 cubrid_result() example
<?php <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mi>o</mi><mi>n</mi><mi>n</mi><mo>=</mo><mi>c</mi><mi>u</mi><mi>b</mi><mi>r</mi><mi>i</mi><msub><mi>d</mi><mi>c</mi></msub><mi>o</mi><mi>n</mi><mi>n</mi><mi>e</mi><mi>c</mi><mi>t</mi><mo stretchy="false">(</mo><mi mathvariant="normal">"</mi><mi>l</mi><mi>o</mi><mi>c</mi><mi>a</mi><mi>l</mi><mi>h</mi><mi>o</mi><mi>s</mi><mi>t</mi><mi mathvariant="normal">"</mi><mo separator="true">,</mo><mn>33000</mn><mo separator="true">,</mo><mi mathvariant="normal">"</mi><mi>d</mi><mi>e</mi><mi>m</mi><mi>o</mi><mi>d</mi><mi>b</mi><mi mathvariant="normal">"</mi><mo stretchy="false">)</mo><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">conn = cubrid_connect("localhost", 33000, "demodb");</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">co</span><span class="mord mathnormal">nn</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">c</span><span class="mord mathnormal">u</span><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal">i</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">c</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal">o</span><span class="mord mathnormal">nn</span><span class="mord mathnormal">ec</span><span class="mord mathnormal">t</span><span class="mopen">(</span><span class="mord">"</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">oc</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">h</span><span class="mord mathnormal">os</span><span class="mord mathnormal">t</span><span class="mord">"</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">33000</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">"</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mord mathnormal">m</span><span class="mord mathnormal">o</span><span class="mord mathnormal">d</span><span class="mord mathnormal">b</span><span class="mord">"</span><span class="mclose">)</span><span class="mpunct">;</span></span></span></span>req = cubrid_execute($conn, "SELECT * FROM code");$result = cubrid_result($req, 0); var_dump($result);$result = cubrid_result($req, 0, 1); var_dump($result);$result = cubrid_result($req, 5, "f_name"); var_dump($result);cubrid_close_request($req); cubrid_disconnect($conn); ?>
The above example will output:
string(1) "X" string(5) "Mixed" string(4) "Gold"
Found A Problem?
There are no user contributed notes for this page.