<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >sqlite_array_query</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="SQLite" HREF="ref.sqlite.html"><LINK REL="PREVIOUS" TITLE="SQLite" HREF="ref.sqlite.html"><LINK REL="NEXT" TITLE="sqlite_busy_timeout" HREF="function.sqlite-busy-timeout.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="ref.sqlite.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.sqlite-busy-timeout.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.sqlite-array-query" ></A >sqlite_array_query</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN105033" ></A ><P > (PHP 5)</P >sqlite_array_query -- Execute a query against a given database and returns an array.</DIV ><DIV CLASS="refsect1" ><A NAME="AEN105036" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >sqlite_array_query</B > ( resource dbhandle, string query [, int result_type [, bool decode_binary]])<BR ></BR >array <B CLASS="methodname" >sqlite_array_query</B > ( string query, resource dbhandle [, int result_type [, bool decode_binary]])<BR ></BR ><P > <B CLASS="function" >sqlite_array_query()</B > is similar to calling <A HREF="function.sqlite-query.html" ><B CLASS="function" >sqlite_query()</B ></A > and then <A HREF="function.sqlite-fetch-array.html" ><B CLASS="function" >sqlite_fetch_array()</B ></A > for each row of the result set and storing it into an array, as shown in the example below. Calling <B CLASS="function" >sqlite_array_query()</B > is significantly faster than using such a script. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN105073" ></A ><P ><B >Exemplu 1. <B CLASS="function" >sqlite_array_query()</B > implemented yourself</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$q </font><font color="#007700">= </font><font color="#0000BB">sqlite_query</font><font color="#007700">(</font><font color="#0000BB">$dbhandle</font><font color="#007700">, </font><font color="#DD0000">"SELECT * from foo LIMIT 100"</font><font color="#007700">);<br /></font><font color="#0000BB">$rows </font><font color="#007700">= array();<br />while (</font><font color="#0000BB">$r </font><font color="#007700">= </font><font color="#0000BB">sqlite_fetch_array</font><font color="#007700">(</font><font color="#0000BB">$q</font><font color="#007700">)) {<br /> </font><font color="#0000BB">$rows</font><font color="#007700">[] = </font><font color="#0000BB">$r</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><DIV CLASS="tip" ><BLOCKQUOTE CLASS="tip" ><P ><B >Indicaþie: </B > <B CLASS="function" >sqlite_array_query()</B > is best suited to queries returning 45 rows or less. If you have more data than that, it is recommended that you write your scripts to use <A HREF="function.sqlite-unbuffered-query.html" ><B CLASS="function" >sqlite_unbuffered_query()</B ></A > instead for more optimal performance. </P ></BLOCKQUOTE ></DIV ><P > See also <A HREF="function.sqlite-query.html" ><B CLASS="function" >sqlite_query()</B ></A >, <A HREF="function.sqlite-fetch-array.html" ><B CLASS="function" >sqlite_fetch_array()</B ></A >, and <A HREF="function.sqlite-fetch-string.html" ><B CLASS="function" >sqlite_fetch_string()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="ref.sqlite.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.sqlite-busy-timeout.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >SQLite</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.sqlite.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >sqlite_busy_timeout</TD ></TR ></TABLE ></DIV ></BODY ></HTML >