1 | <HTML
|
---|
2 | ><HEAD
|
---|
3 | ><TITLE
|
---|
4 | >ingres_fetch_array</TITLE
|
---|
5 | ><META
|
---|
6 | NAME="GENERATOR"
|
---|
7 | CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
---|
8 | REL="HOME"
|
---|
9 | TITLE="Manuál PHP"
|
---|
10 | HREF="index.html"><LINK
|
---|
11 | REL="UP"
|
---|
12 | TITLE="Ingres II functions"
|
---|
13 | HREF="ref.ingres.html"><LINK
|
---|
14 | REL="PREVIOUS"
|
---|
15 | TITLE="ingres_connect"
|
---|
16 | HREF="function.ingres-connect.html"><LINK
|
---|
17 | REL="NEXT"
|
---|
18 | TITLE="ingres_fetch_object"
|
---|
19 | HREF="function.ingres-fetch-object.html"><META
|
---|
20 | HTTP-EQUIV="Content-type"
|
---|
21 | CONTENT="text/html; charset=ISO-8859-2"></HEAD
|
---|
22 | ><BODY
|
---|
23 | CLASS="refentry"
|
---|
24 | BGCOLOR="#FFFFFF"
|
---|
25 | TEXT="#000000"
|
---|
26 | LINK="#0000FF"
|
---|
27 | VLINK="#840084"
|
---|
28 | ALINK="#0000FF"
|
---|
29 | ><DIV
|
---|
30 | CLASS="NAVHEADER"
|
---|
31 | ><TABLE
|
---|
32 | SUMMARY="Header navigation table"
|
---|
33 | WIDTH="100%"
|
---|
34 | BORDER="0"
|
---|
35 | CELLPADDING="0"
|
---|
36 | CELLSPACING="0"
|
---|
37 | ><TR
|
---|
38 | ><TH
|
---|
39 | COLSPAN="3"
|
---|
40 | ALIGN="center"
|
---|
41 | >Manuál PHP</TH
|
---|
42 | ></TR
|
---|
43 | ><TR
|
---|
44 | ><TD
|
---|
45 | WIDTH="10%"
|
---|
46 | ALIGN="left"
|
---|
47 | VALIGN="bottom"
|
---|
48 | ><A
|
---|
49 | HREF="function.ingres-connect.html"
|
---|
50 | ACCESSKEY="P"
|
---|
51 | >Pøedcházející</A
|
---|
52 | ></TD
|
---|
53 | ><TD
|
---|
54 | WIDTH="80%"
|
---|
55 | ALIGN="center"
|
---|
56 | VALIGN="bottom"
|
---|
57 | ></TD
|
---|
58 | ><TD
|
---|
59 | WIDTH="10%"
|
---|
60 | ALIGN="right"
|
---|
61 | VALIGN="bottom"
|
---|
62 | ><A
|
---|
63 | HREF="function.ingres-fetch-object.html"
|
---|
64 | ACCESSKEY="N"
|
---|
65 | >Dal¹í</A
|
---|
66 | ></TD
|
---|
67 | ></TR
|
---|
68 | ></TABLE
|
---|
69 | ><HR
|
---|
70 | ALIGN="LEFT"
|
---|
71 | WIDTH="100%"></DIV
|
---|
72 | ><H1
|
---|
73 | ><A
|
---|
74 | NAME="function.ingres-fetch-array"
|
---|
75 | ></A
|
---|
76 | >ingres_fetch_array</H1
|
---|
77 | ><DIV
|
---|
78 | CLASS="refnamediv"
|
---|
79 | ><A
|
---|
80 | NAME="AEN37330"
|
---|
81 | ></A
|
---|
82 | ><P
|
---|
83 | > (PHP 4 >= 4.0.2)</P
|
---|
84 | >ingres_fetch_array -- Fetch a row of result into an array</DIV
|
---|
85 | ><DIV
|
---|
86 | CLASS="refsect1"
|
---|
87 | ><A
|
---|
88 | NAME="AEN37333"
|
---|
89 | ></A
|
---|
90 | ><H2
|
---|
91 | >Description</H2
|
---|
92 | >array <B
|
---|
93 | CLASS="methodname"
|
---|
94 | >ingres_fetch_array</B
|
---|
95 | > ( [int result_type [, resource link]])<BR
|
---|
96 | ></BR
|
---|
97 | ><DIV
|
---|
98 | CLASS="warning"
|
---|
99 | ><P
|
---|
100 | ></P
|
---|
101 | ><TABLE
|
---|
102 | CLASS="warning"
|
---|
103 | BORDER="1"
|
---|
104 | WIDTH="100%"
|
---|
105 | ><TR
|
---|
106 | ><TD
|
---|
107 | ALIGN="CENTER"
|
---|
108 | ><B
|
---|
109 | >Varování</B
|
---|
110 | ></TD
|
---|
111 | ></TR
|
---|
112 | ><TR
|
---|
113 | ><TD
|
---|
114 | ALIGN="LEFT"
|
---|
115 | ><P
|
---|
116 | >Tato funkce je
|
---|
117 | <SPAN
|
---|
118 | CLASS="emphasis"
|
---|
119 | ><I
|
---|
120 | CLASS="emphasis"
|
---|
121 | >EXPERIMENTÁLNÍ</I
|
---|
122 | ></SPAN
|
---|
123 | >. Chování této funkce, její
|
---|
124 | název a v¹echno ostatní, co je zde zdokumentováno, se v budoucích verzích
|
---|
125 | PHP mù¾e BEZ OHLÁ©ENÍ zmìnit. Berte to v úvahu a pou¾ívejte tuto funkci na
|
---|
126 | vlastní nebezpeèí.</P
|
---|
127 | ></TD
|
---|
128 | ></TR
|
---|
129 | ></TABLE
|
---|
130 | ></DIV
|
---|
131 | ><P
|
---|
132 | > <B
|
---|
133 | CLASS="function"
|
---|
134 | >ingres_fetch_array()</B
|
---|
135 | > Returns an array that
|
---|
136 | corresponds to the fetched row, or <TT
|
---|
137 | CLASS="constant"
|
---|
138 | ><B
|
---|
139 | >FALSE</B
|
---|
140 | ></TT
|
---|
141 | > if there are no more
|
---|
142 | rows.
|
---|
143 | </P
|
---|
144 | ><P
|
---|
145 | > This function is an extended version of
|
---|
146 | <A
|
---|
147 | HREF="function.ingres-fetch-row.html"
|
---|
148 | ><B
|
---|
149 | CLASS="function"
|
---|
150 | >ingres_fetch_row()</B
|
---|
151 | ></A
|
---|
152 | >. In addition to storing
|
---|
153 | the data in the numeric indices of the result array, it also
|
---|
154 | stores the data in associative indices, using the field names as
|
---|
155 | keys.
|
---|
156 | </P
|
---|
157 | ><P
|
---|
158 | > If two or more columns of the result have the same field names,
|
---|
159 | the last column will take precedence. To access the other
|
---|
160 | column(s) of the same name, you must use the numeric index of the
|
---|
161 | column or make an alias for the column.
|
---|
162 | <DIV
|
---|
163 | CLASS="informalexample"
|
---|
164 | ><A
|
---|
165 | NAME="AEN37353"
|
---|
166 | ></A
|
---|
167 | ><P
|
---|
168 | ></P
|
---|
169 | ><TABLE
|
---|
170 | BORDER="0"
|
---|
171 | BGCOLOR="#E0E0E0"
|
---|
172 | CELLPADDING="5"
|
---|
173 | ><TR
|
---|
174 | ><TD
|
---|
175 | ><PRE
|
---|
176 | CLASS="programlisting"
|
---|
177 | >ingres_query(select t1.f1 as foo t2.f1 as bar from t1, t2);
|
---|
178 | $result = ingres_fetch_array();
|
---|
179 | $foo = $result["foo"];
|
---|
180 | $bar = $result["bar"];</PRE
|
---|
181 | ></TD
|
---|
182 | ></TR
|
---|
183 | ></TABLE
|
---|
184 | ><P
|
---|
185 | ></P
|
---|
186 | ></DIV
|
---|
187 | >
|
---|
188 | </P
|
---|
189 | ><P
|
---|
190 | > <TT
|
---|
191 | CLASS="parameter"
|
---|
192 | ><I
|
---|
193 | >result_type</I
|
---|
194 | ></TT
|
---|
195 | > can be INGRES_NUM for
|
---|
196 | enumerated array, INGRES_ASSOC for associative array, or
|
---|
197 | INGRES_BOTH (default).
|
---|
198 | </P
|
---|
199 | ><P
|
---|
200 | > Speed-wise, the function is identical to
|
---|
201 | <A
|
---|
202 | HREF="function.ingres-fetch-object.html"
|
---|
203 | ><B
|
---|
204 | CLASS="function"
|
---|
205 | >ingres_fetch_object()</B
|
---|
206 | ></A
|
---|
207 | >, and almost as quick as
|
---|
208 | <A
|
---|
209 | HREF="function.ingres-fetch-row.html"
|
---|
210 | ><B
|
---|
211 | CLASS="function"
|
---|
212 | >ingres_fetch_row()</B
|
---|
213 | ></A
|
---|
214 | > (the difference is
|
---|
215 | insignificant).
|
---|
216 | </P
|
---|
217 | ><P
|
---|
218 | > <TABLE
|
---|
219 | WIDTH="100%"
|
---|
220 | BORDER="0"
|
---|
221 | CELLPADDING="0"
|
---|
222 | CELLSPACING="0"
|
---|
223 | CLASS="EXAMPLE"
|
---|
224 | ><TR
|
---|
225 | ><TD
|
---|
226 | ><DIV
|
---|
227 | CLASS="example"
|
---|
228 | ><A
|
---|
229 | NAME="AEN37361"
|
---|
230 | ></A
|
---|
231 | ><P
|
---|
232 | ><B
|
---|
233 | >Pøíklad 1. <B
|
---|
234 | CLASS="function"
|
---|
235 | >ingres_fetch_array()</B
|
---|
236 | > example</B
|
---|
237 | ></P
|
---|
238 | ><TABLE
|
---|
239 | BORDER="0"
|
---|
240 | BGCOLOR="#E0E0E0"
|
---|
241 | CELLPADDING="5"
|
---|
242 | ><TR
|
---|
243 | ><TD
|
---|
244 | ><PRE
|
---|
245 | CLASS="php"
|
---|
246 | ><?php
|
---|
247 | ingres_connect ($database, $user, $password);
|
---|
248 |
|
---|
249 | ingres_query ("select * from table");
|
---|
250 | while ($row = ingres_fetch_array()) {
|
---|
251 | echo $row["user_id"]; # using associative array
|
---|
252 | echo $row["fullname"];
|
---|
253 | echo $row[1]; # using enumerated array
|
---|
254 | echo $row[2];
|
---|
255 | }
|
---|
256 | ?></PRE
|
---|
257 | ></TD
|
---|
258 | ></TR
|
---|
259 | ></TABLE
|
---|
260 | ></DIV
|
---|
261 | ></TD
|
---|
262 | ></TR
|
---|
263 | ></TABLE
|
---|
264 | >
|
---|
265 | </P
|
---|
266 | ><P
|
---|
267 | > See also
|
---|
268 | <A
|
---|
269 | HREF="function.ingres-query.html"
|
---|
270 | ><B
|
---|
271 | CLASS="function"
|
---|
272 | >ingres_query()</B
|
---|
273 | ></A
|
---|
274 | >,
|
---|
275 | <A
|
---|
276 | HREF="function.ingres-num-fields.html"
|
---|
277 | ><B
|
---|
278 | CLASS="function"
|
---|
279 | >ingres_num_fields()</B
|
---|
280 | ></A
|
---|
281 | >,
|
---|
282 | <A
|
---|
283 | HREF="function.ingres-field-name.html"
|
---|
284 | ><B
|
---|
285 | CLASS="function"
|
---|
286 | >ingres_field_name()</B
|
---|
287 | ></A
|
---|
288 | >,
|
---|
289 | <A
|
---|
290 | HREF="function.ingres-fetch-object.html"
|
---|
291 | ><B
|
---|
292 | CLASS="function"
|
---|
293 | >ingres_fetch_object()</B
|
---|
294 | ></A
|
---|
295 | >, and
|
---|
296 | <A
|
---|
297 | HREF="function.ingres-fetch-row.html"
|
---|
298 | ><B
|
---|
299 | CLASS="function"
|
---|
300 | >ingres_fetch_row()</B
|
---|
301 | ></A
|
---|
302 | >.
|
---|
303 | </P
|
---|
304 | ></DIV
|
---|
305 | ><DIV
|
---|
306 | CLASS="NAVFOOTER"
|
---|
307 | ><HR
|
---|
308 | ALIGN="LEFT"
|
---|
309 | WIDTH="100%"><TABLE
|
---|
310 | SUMMARY="Footer navigation table"
|
---|
311 | WIDTH="100%"
|
---|
312 | BORDER="0"
|
---|
313 | CELLPADDING="0"
|
---|
314 | CELLSPACING="0"
|
---|
315 | ><TR
|
---|
316 | ><TD
|
---|
317 | WIDTH="33%"
|
---|
318 | ALIGN="left"
|
---|
319 | VALIGN="top"
|
---|
320 | ><A
|
---|
321 | HREF="function.ingres-connect.html"
|
---|
322 | ACCESSKEY="P"
|
---|
323 | >Pøedcházející</A
|
---|
324 | ></TD
|
---|
325 | ><TD
|
---|
326 | WIDTH="34%"
|
---|
327 | ALIGN="center"
|
---|
328 | VALIGN="top"
|
---|
329 | ><A
|
---|
330 | HREF="index.html"
|
---|
331 | ACCESSKEY="H"
|
---|
332 | >Domù</A
|
---|
333 | ></TD
|
---|
334 | ><TD
|
---|
335 | WIDTH="33%"
|
---|
336 | ALIGN="right"
|
---|
337 | VALIGN="top"
|
---|
338 | ><A
|
---|
339 | HREF="function.ingres-fetch-object.html"
|
---|
340 | ACCESSKEY="N"
|
---|
341 | >Dal¹í</A
|
---|
342 | ></TD
|
---|
343 | ></TR
|
---|
344 | ><TR
|
---|
345 | ><TD
|
---|
346 | WIDTH="33%"
|
---|
347 | ALIGN="left"
|
---|
348 | VALIGN="top"
|
---|
349 | >ingres_connect</TD
|
---|
350 | ><TD
|
---|
351 | WIDTH="34%"
|
---|
352 | ALIGN="center"
|
---|
353 | VALIGN="top"
|
---|
354 | ><A
|
---|
355 | HREF="ref.ingres.html"
|
---|
356 | ACCESSKEY="U"
|
---|
357 | >Nahoru</A
|
---|
358 | ></TD
|
---|
359 | ><TD
|
---|
360 | WIDTH="33%"
|
---|
361 | ALIGN="right"
|
---|
362 | VALIGN="top"
|
---|
363 | >ingres_fetch_object</TD
|
---|
364 | ></TR
|
---|
365 | ></TABLE
|
---|
366 | ></DIV
|
---|
367 | ></BODY
|
---|
368 | ></HTML
|
---|
369 | >
|
---|